I have a combobox which needs to call a function f(combobox.value) during its onChange event. Currently though, combobox.value appears not to change before the onChange event, and so the function receives the wrong (last) value.
Note - the actual text in the text field of the combobox *has* changed to the new value before the onChange event occurs.
Any ideas why this might be?
Edit - Also the problem doesn't happen when selecting with the mouse, only when using the up and down arrow keys to move through the list.
Is there a central reference on the net that explains the pro's and con's of each of the event types. I historically have used the OnChange event until the other day when someone suggested using the AfterUpdate instead.
Would like to ensure that I have the best event trigger being used where possible in various situations
I have a form which displays information in the footer until the use has accomplished some tasks. Once I verify that all is well I allow the user to change the fields in the footer. I want to verify that the proper changes were made but the BeforeUpdate event does not fire until the form is closed.
I would like to create a query that would do the following give me all dates that occurred within the last six months triggered by a date entered into table which when reached it would trigger an email being sent. To explain more detail I am working on a funeral home database. (Which seems like a never ending but I am learning so much so I want to keep building it). Once I enter the date of death field name (DOD) I want query to all deaths that happen prior to past six months from current date. Which would trigger and email that would notify me to send a follow up letter for family.
I have a table in Access with a field End Date with couple of other fields like Company Name and Description associated with the End Date as one record. In other words, one record has fields Company Name, Description and End Date.how could I get Access trigger an email automatically to a set of people let's say a month before the End Date is approaching. If the End Date is 30/4/2015, I would need Access to be triggering an email to the recipients on 30/3/2015.
I'd like to call a function when a bound textbox is updated and for some reasons it doesn't seem to work. It works when the textbox is unbound (or maybe I missed something) Here is a very simplified version of the form: http://img207.imageshack.us/img207/3618/apf4ax.jpg
MyFunction() is just a MsgBox for now and I'd like it to appear when the textbox in the main form is updated (i.e. when the text in the subform is updated). I set .AfterUpdate= "=MyFunction()" and .OnChange="=MyFunction()" but nothing happens. (see attached code)
I use the events afterInsert of a Form frmA and the onChange of a field in the same form in order to make some changes to another Form frmB.
Everything goes as expected when the field (with the onChange event assigned) of an existing record changes. The problem starts when I add a new record which triggers both AfterInsert event (desired) and onChage event (undesired).
Is there a trick to separate the two events? Basically I want to call a Sub when the data on the field change (onChange) and a different Sub when I add a new record (AfterInsert).
On my form i have a control called WeekDate (this is always the start of the week (monday), below i have a subform (sbfrmWorksheetDetails) contained in a tab control (tabWeek) with 5 pages for each day of the week, i have written a select case statement in the onchange event for tabWeek which selects records based on the day of the week (so = WeekDate for Monday, +1 for Tuesday, +2 for Wednesday etc), this works great, i have also put a bit of code in the same onchange event that makes the default value for a new record for the field WorkDayDate in the subform +1 and +2 etc. this works great for existing records, each new line in the subform puts the right date in, however this seems to cock up when clicking on a new tab that doesn't have a record in..Here's the code.
Private Sub tabWeek_Change() Select Case tabWeek Case 0 'Monday Forms!WeeklyWorksheet!sbfrmWorksheetDetails.Form.R ecordSource = "SELECT * FROM tblWorksheetDetails WHERE (((tblWorksheetDetails.WorkDayDate) = [Forms]![WeeklyWorksheet]![WorksheetDate]))" Forms!WeeklyWorksheet!sbfrmWorksheetDetails.Form!W orkDayDate.DefaultValue = SQLDate(Me.WorksheetDate) Case 1 'Tuesday Same as above but WorksheetDate+ 1 for both select and default value. Case 2 'Wednesday Same but +2 etc. End Select End Sub
the SQLDate is some code that converts the american US date formatting to UK formatting. i'm not sure if that's the problem, but i'll post that anyway:
Function SQLDate(vDate As Variant) As String If IsDate(vDate) Then SQLDate = "#" & Format$(vDate, "dd/mm/yyyy") & "#" End If End Function
I can't quite work out what screwing this up upon adding a new record.
I have an Access 2010 form within my database in which I have a series of 8 tabs on a tab control. I am the only user who will have access to these tabs. I want to require a password in order to permit access to the tabs. The very first tab on the tab control works as a cover tab. There is no relevant information for anyone to view...only a graphic.
How to code the "on change" event of the tab control.
Often I use Labels as buttons due to the fact I can colour them the way I want, and use the on click event to trigger code. The code below however works for a command button, but not a label button.
DoCmd.OpenForm "frmdatetime" Do While Forms!frmdatetime!OKFlag.Caption = "False" DoEvents Loop
When this code is run by clicking on a command button, it works fine. If run by clicking on a label, frmdatetime opens, but the mouse will not work on either of the 2 open forms unless you go down to the windows task bar, jump onto another window, and back onto frmdatetime. If I remove the loop with the DoEvents in it, then the problem does not occur.
Can anyone enlighten me as to why this behaviour occurs.
I have a subform which makes a change to a field on the main form. When focus is returned to the main form, the BeforeUpdate and AfterUpdate events fire. Why? I thought from the form's perspective, the subform is just another control.
BTW, I get the same behavior if I modify the field from within the Exit event of the subform control.
In either case, the main form's Dirty event is NOT triggered.
I am trying to change the button color on a subform if a related form data changes.Main form is products with a continuous subform with serial numbers of products i.e, serial number, location, price and a button to add addtional issues if there are any for this particular serial number (this will open up another form related to the serial number so I can add an issues if there are any).The reason I would like the button to be a different color is so I can quickly see if there are any additional notes been added to the serial number. Just in case you may ask why not add the field to the continuos form is that the issues and be quite lengthy and there may be lots of serial numbers on the form
I have not done much work in later version of Access. Now I found if I change a design in one form and similar forms (names are different) which are linked to the same tables got changed as well without openning them up and making changes. Is this something new with Access 2003?
What I want to do is following. In form ASSIGN(fields are takedate and inout) ,if TAKEDATE is different then 0 then set value of inout field to 1 My VBA knowledge is poor cause i dont think this should be hard
ie from within a db, opened as one username and password decide want to run db as other user , rather than close the db and reopen it (entering new usrname and password) , can I build a form where you just enter the new username and password, and continue running the db as the new currentUser?
Hi, hope someone knows the answer to this one...:p
We started a new business and built a db for expecting our work to happen a certain way, but now find it's very different and need to change the structure before it's too late to fix. Can someone please take a quick look at this idea & tell me if it's likely to cause major problems down the road?
People send in applications for specific groups/clubs. We thought they would arrive separately, so we set it up to enter each application and then add them to the Group listing one by one. TblApplication is a many-many with tblGroup, with junction tblGroupAppl. (People can be in more than one group.)
As we go along, however, we are finding the opposite: all the individual applications are being sent together by the club and so now we could actually turn this into a simple 1-many with tblGroup as parent and tblApplication as child. It seems like it would be much easier with queries and such if that extra step could be eliminated.
If I go through and put the GroupID on each record of tblApplication, can you see anything I might be inadvertently wrecking with this approach?
I am using access 2003 and have a database with over 1500 rows I have many queries and reports relating to this database One of my agencies changed their name and I want to know what is the best way to change the name in the whole database, including queries and reports
I have a form with a subform that is set to continuous. I have a field [Info][.RemovedP]. What i want is if RemovedP = -2 then i want the bg colour of JUST that record to be changed.
The default is blue, so what i will then get is blue bg for all the records accept if the RemovedP ='s -2, it will then be red.
I have a form with 6 field boxes - What I want to do is - on change of any of the fields value will change the background colour of all the fields in that record.
When I go to the next record all the fields will be their original colour until I change the value in any of the fields again - however if I am browsing the records - no colour change takes place.
I do not know how to code this:confused: - I would appreciate any clues to solve this.
I want to add a form that will let me take a clients unique Key and change it to the # that i want and with the click of a button have it cascade to all the other tables. with relations ships set it wont let me make any changes. any ideas on how to tackle this.
Just wanted a little help please. I have about 100 option boxes on a form and I want to be able to change the names of the option box and its label. I want to name them from 1 to 100 sequentially. (i.e. option1, option2 ...).
When I create the controls it automatically names them option0, option2 etc. and label3, label5 etc.
I was going to change them via some code but I don’t know how to refer to a control in a form from design view.
I need to change the reference "Microsoft Access 9.0 Object Library" in Access 2000 with the "Microsoft Access 11.0 Object Library" but I can't de-select it 'cause it's used by the program. Another problem is that I tried to import the 11.0 copying the file and when I select it from the panel control it seems to import without problems, but when I search it in the list, the 11.0 doesn't exist. How can I import it?
I have a basic question I want to change the forecolor of a text box when another text box or possibly a Yes No box is true. Can you tel me the correct way to code this.