Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to get a date to auto update if record is edited?

Status
Not open for further replies.

MariaL

Instructor
Jun 23, 2003
50
US
Hello everyone. I have added an "EditDate" field to a table. I want this field to automatically update to today's date if anyone edits the record.I have the default set to, =date(), but it doesn't change if I edit the record. Any ideas? Thank you for your time and help.

 
If you're in a form, on the form's BeforeUpdate() event, set your textbox to =Now() or =Date() or whatever variant you wish.
 
Thank you for your help. I'm still having problems. The EditDate field was pulled from the table on the form. I went to the properties to BeforeUpdate and chose event. What should I type here? It's a field name, not a text box. does that matter?

 
MariaL

You may be missing a step here. For the before update event field property, create an event.

When in the field before update field, either click on the down arrow, or type "[e" to bring up "[event procedure]"

Now click on the "..." box immediately to the left of the field. This will take you to the VB editor. Type

me.fld_name = now()

and then exit the VB editor. (Note how the VB editor started to bring automatically brought up your field name when you typed "me." - hit the space bar to select variable or keep typing the name.)

ALSO
Since this field is updated whenever you create or edit the record, don't allow the user to edit it -- no point. Either make the field invisible, lock the field, set enabled to false using the field property.

Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top