Record Update Field

S

Steve Crowhurst

Could somebody tell me how to design a field that will
record exatcly when each record was last updated, I
presumed this will be a calculated field.Thank you for
your time.

Steve
 
A

Allen Browne

This can only be done if you always modify your records through a form.

1. Open your table in design view.

2. Add a field with these properties:
Name UpdatedOn
Data Type Date/Time

3. In the BeforeUpdate event procedure of your form, add this line:
Me.UpdatedOn = Now()
 
G

Guest

This is very helpful and has certainly done the job, but
how do I adapt the event procedure to allow this to be
used in more than one form in the same database?

I tried it and I get a "compile error"
I presume I need to refer to a specfic form as opposed
to "Me".UpdatedOn = Now() At a guess it's something like
Forms!frmPrimarySubForm etc... Any help would be greatly
appreciated, thank you guys.
 
A

Allen Browne

No, Me *is* a reference to the current form, and should work even if the
form is renamed.

Make sure that each form's table has a field named "UpdatedOn" of course.
And if the form is based on a query, remember to include the field in the
query also.

If it still spits the dummy, you could try:
Me!UpdatedOn
Sometimes the bang works better than the dot when you are referring to a
field in the form's RecordSource that is not represented with a control on
the form, especially if the form is based on a query or attached table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top