What is it that you are storing? As an example, let say the you are storing employee addresses, you can create a table that contains two columns, one with the employee's name (or ID) and another column called "last_updated". Everytime you make a change in the form (ex: when clicking the save button), in your code you edit the record containing the last_updated value to equal the current date (you can get the current date by using the Now() function).
I'm storing basic demographic information, so what they'd like is that if you update the address field, the last date updated field would automatically update.
You mentioned code - I've added =Date() to the underlying table and to the default value for the field but it only inputs the date on new records. On the Save button that I have on the form, can I OnClick have it update the date field?
There are two general ways of updating a field in a table (in this case a "last_updated" field). You could use an Update Query or code the update by using "Edit" method of a recordset collection. Could you first tell me what field uniquely identifies each record (Primary Key.
1. Put this code behind AfterUpdate event of any fields that you would like to also update you date field:
Me.YourFieldName.Value = Date <-- This will store only the date.
or
Me.YourFieldName.Value = Now() <--This will store the date and time.
Everytime the user moves from one field to another or clicks on any buttons (also put this code on the OnClick Event of that button as well) will update your date field.
I added the code:
Me.EDATE.Value=Date on my firstname field but when I moved to another field I was told that "The Macro or Macro group does not exist, or the macro is new and hasn't been saved. Note that when you enter the macrogroupname.macroname syntax in an argument you must specify the name the macro's macro group was last saved under.
Edate was the field on the form. I made a text box using the edate field, then entered [Text110].Value=Date() in the last name properties AfterUpdate but it tells me that it can't find the macro Text110.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.