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

Updating date in "last updated" date field

Status
Not open for further replies.

vikunja

Technical User
Jun 6, 2002
18
NO
Hi

Having trouble with updating todays date in my "last updated" date field. I have tried using:

Private Sub Form_BeforeUpdate(Cancel As Integer)
Me!ddato = Now()

End Sub

and the same piece of code on every other form field.

The wierd part is i have two fields which have combo boxes, when choosing a value from these two, the date field updates, but none of the fields update the date field.

appreciate any help

thanks in advance!

A.S
 
I assume you mean:-
but none of the textbox controls update the date field

Why bother ?

The FORM will update the ddato field when the form updates so you do not need the ddato to be updated on every control as well.

& if ddato is the name of the control on the form then you don't need the Me! qualifier.


As you imply - if you have a text box control txtDemo, then
Private Sub txtDemo_BeforeUpdate()
ddato = Now()
End Sub

SHOULD work fine.



'ope-that-'elps.

G LS
 

It probably is working fine. Set a breakpoint on the first line, modify a control on your form, and update it. You will see that the event fires before the record is updated. Now, of course, if you do not change anything, the before update event won’t fire.

Just as a point of interest, if you do not need the time of the change, replace now() with date().
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Hi

Thanks for all the help, changed the code and now it is working fine.

A.S
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top