storing the date/time when a record is modified

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I posted this on the general access q's and the response I got didn't work
(which means I am much to new to Access to understand!). So I'm re-posting
here--hope thats ok!

I need to automatically store when a record is modified on a form. I added
a field called "dateupdate" in the table. I then tried to add code to the
form properties in the "before update" box....but nothing shows up. I then
tried to the same code to the text box properties and that didn't record
anything. I have also tried creating a macro [set value = Date( )] and
attaching that to the form and then when that didn't work, I set it for the
text box! We're using Access 2000...

What am I missing?
thanks a bunch...
 
Visual Basic code. I would choose the after update event.

me.dateupdate = now()

Put this code on a macro button and test it. Then think of when you will
trigger the update.
 
It's working! I'm so excited-especially since nothing else has worked!

Is there a way to tie this response to the form display in a field? (I can
see the actual date/time updated in the table, but it's not displayed on the
form itself). Is that because it is an update event (maybe this should be
hidden)? I still don't understand how I can attach this to something that
will automatically record the information (vs. having a macro button). It is
important that the users don't have to click a button to change the
DateUpdate field.

Thanks so much!
Donna

SacCourt said:
Visual Basic code. I would choose the after update event.

me.dateupdate = now()

Put this code on a macro button and test it. Then think of when you will
trigger the update.

--
Self taught user of Access 97 – 2003 with 7 years of experience with is part
of 20 years of overall database experience. I'm still learning.


Donna said:
Hi!

I posted this on the general access q's and the response I got didn't work
(which means I am much to new to Access to understand!). So I'm re-posting
here--hope thats ok!

I need to automatically store when a record is modified on a form. I added
a field called "dateupdate" in the table. I then tried to add code to the
form properties in the "before update" box....but nothing shows up. I then
tried to the same code to the text box properties and that didn't record
anything. I have also tried creating a macro [set value = Date( )] and
attaching that to the form and then when that didn't work, I set it for the
text box! We're using Access 2000...

What am I missing?
thanks a bunch...
 
Is there a way to tie this response to the form display in a field? (I can
see the actual date/time updated in the table, but it's not displayed on the
form itself). Is that because it is an update event (maybe this should be
hidden)? I still don't understand how I can attach this to something that
will automatically record the information (vs. having a macro button). It is
important that the users don't have to click a button to change the
DateUpdate field.

I'd use the Form's BeforeUpdate event. It only fires when the user has
completed entry of data into the form and does something which would
save the record (such as moving to a new record). It won't be visible
while the user is editing the record, because the user hasn't SAVED
the record - and if you want to store the time that the record was
modified, that event has not yet happened! If the user goes back to a
previously modified record, the time that it was modified will be
shown (and will be overwritten if they make another change to that
record, when they move off the record or close the form).

John W. Vinson[MVP]
 
One more problem...I put the code in the main form's property, however, when
I update the subforms, it doesn't change! There are actually 3 subforms and
a tabbed form on the main. Where should it be put to trigger when any of
these forms are updated?

Sorry if this is unclear...
Donna
 
One more problem...I put the code in the main form's property, however, when
I update the subforms, it doesn't change! There are actually 3 subforms and
a tabbed form on the main. Where should it be put to trigger when any of
these forms are updated?

In the BeforeUpdate event of each of those forms. You will need to set
the value of the textbox in the mainform - either

Parent!DateUpdate = Now

or

[Forms]![mainformname]![DateUpdate] = Now

John W. Vinson[MVP]
 
Back
Top