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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

todays date in table field when form is updated 1

Status
Not open for further replies.

skaurd

Technical User
Jun 4, 2002
51
GB
HI

How would I get my form to add todays date and the time when a user updates the data?

many thanks

S
 
In the form's Before Update you can use this code:

If me.dirty then
Updated=Now()
endif

Updated is the field in my recordsource that has the date and time an update was accomplished on the current record. If any changes are made to a record the Dirty property of the form becomes true. John Ruff - The Eternal Optimist :)
 
HI JOhn

I tried this but I get an error message when I try to edit any data;

Compile error
Block if without if

many thanks

Sukhi
 
John

Sorry false alarm - it worked just fine (after I typed it correctly (duh))

many thanks

S
 
Sorry John

It worked fine on one of my forms, but ot doesn't work for another which has a sub form combo list (which you can open the form with if you selelect a particular record

Code is like so;

Private Sub Form_BeforeUpdate(Cancel As Integer)
If Me.Dirty Then
last_updated = Now()
End If
End Sub

thanks

S
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top