Something Like A "Current Control" Constant?
Aug 27, 2007
Hi, I am using a macro in order to change a value after a control has been updated (using the AfterUpdate field). The problem is that I would like to use a single macro for all the controls (since the macro does the same thing on every control and I have many controls), not a new macro every time (nor a macro with many rows); is there any way to put into an expression something like "Current Control" constant instead of [Forms]![New]![Surname], [Forms]![New]![Name] etc...? something like [Forms]![New]![CurrentControl]? Thanks.
View Replies
ADVERTISEMENT
Jun 1, 2005
I am having trouble with a continuous form setting Enabled to False in the current record only. I have tried code in the OnCurrent of the form and OnOpen, examples like
If Me.NewRecord then
Me!Quantity.Enabled = False
.....
also
If Me.NewRecord = True then 'if this makes any difference?
Dataentry is set to Yes and have tried No also with no difference.
So I can set all [Quantity].enabled to false but I only want to set the New Record, not all the records I have already created.
Any help would be appreciated as I still have a pretty basic knowledge of Access
View 5 Replies
View Related
Jul 23, 2014
So I have a control called txtBranch. If the user does not put 1 of 4 options then a msgbox pops up and says that is an invalid option and then gives all the valid options. It then sets the value to blank. Then it moves to the next field. I do not want it to move to the next field. I want it to stay on txtBRanch till it has a correct value. I have tried DoCmd.GoToControl "txtBranch", Me.txtBranch.SetFocus on the OnExit, OnLostFocus, AfterUpdate events and it still continues to go to the next control how do I get it not to go to the next control?
View 9 Replies
View Related
Sep 27, 2006
Hi
Newbie question, here.
I have a table T_RollDate
It only has one field, called RollDate
It only has (and only ever has) one record (being a date)
I also have a form F_RollDate that has T_RollDate as record source, containing a text box that has RollDate as the control source.
It has been suggested to me that I can interrogate the value of the record in T_RollDate as if it were a constant, and use that constant in (eg) other select queries. To be precise, I was told that
forms!F_RollDate!RollDate
would return the value of that record.
I cannot get this to work (assuming that it should be possible). If I refer to forms!F_RollDate!RollDate in an query then when I run the query I am prompted to enter a parameter value for forms!F_RollDate!RollDate, where I had hoped that it would select the value of the only record in T_Rolldate.RollDate.
Any pointers would be much appreciated.
View 2 Replies
View Related
Nov 10, 2014
I have created a new form with a few tabs, I need to let the value's of the last record be carry to a new record, but it must only show when I press the first letter on the new record, I did rerad about this, but only find it for normal forms. Did try to get it to work, but it dows not work on tabs form
View 2 Replies
View Related
Aug 13, 2007
Hi at the moment I am using a bit of VBA code like below:
Public Const currentYear As String = "0708"
Static Function GetCurrentYear()
GetCurrentYear = currentYear
End Function
I then call this from my ms access sql statement with GetCurrentYear() am I correct in thinking this will only need to be evaluated once (I am just thinking in terms of performance) as it is a static function and a constant or is there a quicker way to do this. I couldn't see a way to easily get the value from a constant without a function. I may be missing something though thanks for any advice.
View 4 Replies
View Related
Sep 15, 2005
Hi all,
I tried to display a variable and constant onto a text box by putting =myvariable onto the data source of the text box. However, Access seems keep threating my variable as a data field and giving me error message. What to do with this?
View 1 Replies
View Related
Jun 30, 2015
why my access always go over the loop that I am declaring..Here is a sample of my code:
Code:
Dim rs As New ADODB.Recordset
rs.ActiveConnection = conn
rs.Open mySQL, conn, adOpenDynamic, adLockOptimistic
For lngProd = 1 To 5
[code]...
I get the error of access cannot find the tbl_data6. Where in the declaration I wrote 6??
View 1 Replies
View Related
Jul 29, 2006
Can anyone help me with setting up a Visual Basic project to where the datasource I use is a Access database on my harddrive. This Access database isn't linked to a server or anything. It's just a database I created and would like for my project to open this file everytime it's attempting to pull data. How can I make this connection? If I am able to use ADO, how do I go about doing this? I would think ADO wouldn't be necessary though.
View 1 Replies
View Related
May 29, 2014
I'm trying to do the following with the code below:
1. If the file is not in your My Documents folder than goto errhandler and a message box pops up asking you to retry or cancel.
2. When the user clicks retry it goes back and trys again but if the file still isn't there a runtime error 1004 occurs.
I want it to continue to loop when the user presses retry or until cancel is pressed. I've been trying with the code below but no luck.
Code:
Public Function AddITARPicOffloadAnalysis()
Dim xlApp As Object
Dim wb As Object
Dim ws As Object
Dim Lastrow As Long
Dim objFolders As Object
Set xlApp = CreateObject("Excel.Application")
[Code] ....
View 7 Replies
View Related
Jan 26, 2014
I have a table that is populated everyday, with following columns:
1. ward (linked to the wards table)
2. date
3. number of patients
We have a total of 18 wards, wherein the daily number of patient in each ward should be recorded. The problem we face is that we find it counter-productive if the data encoder selects a specific ward (dropdown list), then puts the number of patients, and then moves to another field repeating the process. (the date is pre-selected using a combo-box and this will fill the date fields, thus the encoder selects the date only once).
I was wondering if there is a way where we can just automatically show all the wards, so that the data encoder would just proceed on putting the figures.
View 2 Replies
View Related
Aug 25, 2011
I have a column with a sum total in the footer. I would like to subtract this calculated number from a constant (i.e., 20,000.00). Is this possible?
View 3 Replies
View Related
Nov 3, 2006
Hi everyone,
I have refined my query from previous threads to involved a module function. This calculates more acurately no of working days between dates and takes into account a holidays table. (All credit to Arvin Meyer on the module:) )
However because the Leave Year starts at the 1 July and finishes 30 Jun I need to compose the date for any current year Year(Now())
Enclosed scrdmp shows my query design. I can easily get it to work as you see it, but obviously as each year rolls over, the year needs to change.
Have looked at many posts but can't find what I'm looking for. This one will get me over the hurdle.
Many thanks,
View 6 Replies
View Related
Aug 27, 2013
What I really need is for when the form opens, it looks at todays date, then matches current user and then goes to that record for today, if no current user there, then will goto new record..
i know, sounds complicated, and probably is really easy, but my heads not with it today, as about to get drunk as its my 40th, and got people ringing and texting and still trying to get this done....
I've included a copy of this database, named Timecards..
View 1 Replies
View Related
Sep 24, 2013
I added a new field to one of my tables and query, but when I try to add a control for that field into my form it is not recognising it and the field isn't appearing in the sources for the form, even though the table is sourced to the form? Or am I going to have to do the usual and redo the entire form because I made a minor adjustment?
View 1 Replies
View Related
Jun 18, 2014
I have a form with a tab control, inside the tab control I placed an ActiveX control (Microsoft Web Browser). These are at the bottom of the form.
Everything displays fine if the entire form fit on the screen but if the form is too long and I scroll down the browser control is getting obscured by the tab control and getting chopped off (the contents are covered). It is as if the browser control is staying in space where it was and moving behind the tab control as I scroll.
This problem does not occur if I place the browser control directly on the form. Also I note that the browser control is sitting correctly within the tab control.
I have been through all the settings and properties of both controls and haven't been able to fix it. I searched all over the web but no one has previously stumbled across this one by the look of it.
See the attached image ...
View 3 Replies
View Related
May 28, 2015
I have table that I had to add a new field to which we update with a form. I tried to add a control for the new field but the field does not show up in the list for the control source. I am trying to add a list box to the form with a blank and 5 options.
I have attached screen shots of the table design and the form. The table has the field in datasheet view and I have manually entered a few entries in it but it still will not show in the control source for the form control. The top section of the form is where we enter and select the data for the new records. The bottom section (circled in red) autofills the matching record, from separate tables, for updating with the new entries.
I have added form controls for modified fields in the past so I am confused about why this is happening.
View 2 Replies
View Related
Aug 3, 2006
OK. I have searched and searched and every thread dances around similar situations but none seem to address this particular one. I am trying to make a control on a sub form visible/not visible depending on the condition of a control on a main form. The catch is that the control I'm trying to change the state of is on a subform located in a tab control. I've tried a thousand combinations and none seem to work. How do I reference the control on the subform in a tab control?
Main Form: frmMemberMain
Tab Control: TabCtl12
Tab Control Page: 2
Subform: frmChildren
Control on subform: txtRelationship
Can someone please help before my brain explodes!! Thanks! :eek:
View 5 Replies
View Related
May 17, 2006
Hi,
I have reviewed the posts for 'Control Validation' and dowloaded the sample database kindly posted by ansentry.
In the PaymentAmount example, a name has to be entered in the first control before an amount is enterered in the second control. If the controls and tab order are reversed, the validation doesn't work.
I have a form where the 1st Control needs validating before moving on. The code below doesn't work.
Private Sub Form_BeforeUpdate(Cancel As Integer)
If IsNull(Me.Employee_No) Then
MsgBox "Employee No Required", vbCritical, "Data required "
Cancel = True
Me.Employee_No.SetFocus
Exit Sub
End If
End Sub
Any help greatly appreciated.
John
View 2 Replies
View Related
May 19, 2005
hi,
I have a simple qst. I have a subform that I show as a grid.
I have a field called importe that I need to do an insert with it when I press a button on my form.
The thing is.
How Can I get the current row of the grid in the subform?
After I get the currentrow, How can I insert this value on a variable via vb script?
I'm using access 2003
thanks
MAriano
View 1 Replies
View Related
Aug 23, 2005
I need a query so that only date in the current week ending are shown i.e. so that the query automatically updates every week to show the latest data for the week ending.
Cheers,
Andy
View 4 Replies
View Related
Jul 19, 2005
There's this problem that has been racking my brain all day. I have a form that contains a subform (modelling a many to many relationship). So a person and the applications he/she uses. I then have a combobox with a list of applications and a button below the combobox. When something is selected from the combobox and then the button is pressed, the application gets connected to the user. The problem I'm having is that say a person is just being added and no information is entered yet. If the user tries to add an application, my code tries to tie the two key's (autonumber id's) together (but there isn't one yet for the non-existant person) and the code blows up. Shouldn't access just make one when the form is opened? I guess access waits until there is data added in order to create a new primary key.
So I really don't have a clue how to solve this issue. I tried just running an insert SQL statement but I have no data to insert. And then, I would have to use a DLookup for the id, but I would have nothing to search on. I really don't know how to fix this problem. Any ideas?
View 2 Replies
View Related
Jun 13, 2005
Just curious as to what others are working on. Here is what I'm in the middle of and what the basic purpose is:
It's a db to track parts we swap with our customers. It's primary table is on a sql sever so that the anyone in our company can view only the data via DAP's. The other tables are in the .mdb on the file sever. I plan on having it up and running in the next week or so. It will be used (add/edit,etc data), by approx 8-15 users in three different buildings off a file server share folder...
See screen shot attachment.
View 8 Replies
View Related
Apr 18, 2006
I'm creating a database for a college assignment, and for this database, I need to record the current user ID when a record is created/updated. But I dont know the function (like, Now() returns the current date/time) that gives me the user ID. The help files are awful and I cant find the function I need =(
View 2 Replies
View Related
Jun 9, 2005
Hi
Probably an easy one here.. Got a table that I will like to do a query on.. All I need is to list all records for the current month. So obviously, when it goes to the next month, the query would update and show only records for that month.
What do I need to put under the date criteria to get this query?!?.. Any ideas?
Thanks
Saifon
View 3 Replies
View Related
Jul 6, 2005
Hi,
I have around 50 jobs on a table. These have a 'start date' of various dates in a year. A field called 'complete' indicates whether a job has been closed off or not and a field called 'frequency' determines how often the jobs recurr (in days).
I need a query (which I'll run every night) which will examine all the incomplete jobs on the table and copy all this data to new jobs and change the 'start date' to the previous 'start date' + 'frequency'.
That in itself is not the problem. My problem is how to tell Access that when the current and next instances of a job exist, not to copy it a third time.
In other words, after the query runs there should always be 2 instances of the job on the table...current and next.
Can someone please advise me what I should do?!
Thanks in advance
View 2 Replies
View Related