Showing 'last updated on' info

danikuper

Registered User.
Local time
Today, 08:18
Joined
Feb 6, 2003
Messages
147
I'm using a form showing one record at a time.

Is it possible to display to the user at the bottom of the form a textbox with info showing when that record was last updated (Date/time)?

thanks!
 
Yes.

Add a date object (esp. dtUpdate) to the form recordsource table and the form. Then on the form BeforeUpdate event include code similar to the following:

if me.newrecord or me.dirty then
me!dtUpdate=now
end if
 
Great!
thanks.

:D
 
OK.

What if my form has a button that opens another form where the user inputs more info pertaining to that record? The before update event will only be fired if the main form is dirty but if the user goes back to that record and clicks on the button and fills out the other form, when going back to the main form the dtUpdate won't be affected.

How can I change the dtUpdate in case that happens?

hope this makes sense... it's too early in the morning :o
 
danikuper,

Just an idea....

Declare a Public variable at module level, so it's accessible from all forms. Make it a Boolean type. In the OnCurrent Event of the main form, set it to False. When another form is updated, set the variable to True in the forms AfterUpdate event. When you return to the main form, test to see if it's set to True, and if it is, update the field. When done, set the variable to False.


hth

Gerhard
 
In some situtations you may not get back to the calling form and would lose any changes made there. I have an mdb where I keep several forms open all the time to increase the speed of the mdb. I save the data on each form if dirty, before leaving it. I may never get back there before the mdb is closed.

Check the dirty property before the second form is opened and before the before second form is closed, in both cases update me.dtUpdate and save the record if the me.dirty = True.
 
You guys gave me an idea that it seems to work.

In the form I'm opening from the main form I added the following statement to the "On Dirty" Event: Forms![frmCampaign]![dtUpdate] = Now()

Simple, but it works.

thanks!!!
 

Users who are viewing this thread

Back
Top Bottom