update date/time of record

Blueraven

New member
Local time
Today, 21:49
Joined
Dec 15, 2005
Messages
8
Hi, on a database I created with probably over one hundred fields in it I have one text box called update. What I want is if ANY of the fields are altered it then updates the "update" field with date and time. At the moment I have started altering every field with creating an event proceedure in the "on change" entry which reads as below for a change to text5 box. (text141 is the update field)

Private Sub Text5_Change()
[Text141] = Now()
End Sub

Now, although this works; as you can imagine it's very time consuming going through every single field I have puting this proceedure in place. My question.....Is there a much simpler way of making this "update" field change if any part of the record gets altered ?????

Hope this isnt confusing.

I should add that each record has about 4 tabs(pages) too, so the overall record is spread over all this too. I need something that knows that anything is altered on the record and so update the "update" field
 
Look into the "Dirty" event of the form object.
 
Put your code in the BeforeUpdate event of the Form. This event always and only fires when data has changed and just before it is saved. Keep in mind that switching tabs on a tab control will fire a save operation if one is needed. This way you let Access worry about the Dirty flag.
 
Excellent...does exactly what it says on the packet.

Thank you all so much.
I'm sure I've got a million other questions to try to improve on my work. :)
 
What actually is that "dirty" flag anyway.....and it seems an out of place name, why is it called that ??
 
I remember calling that flag the "Dirty" flag when writing virtual memory schemes many decades ago. If a program wrote to the memory buffer it then became necessary to write that buffer back to disk. If they didn't write to that memory buffer you could overwrite the buffer with the next segment of virtual memory. It only took one bit to flag the area as dirty and require the write back to disk. Access simply uses that same scheme. Any field that has changed sets the Dirty flag and requires the entire record be written back to disk. If the user leaves all of the field alone and request another record, the area can be overwritten with the new record without first writing the data to disk. It is a rather simple and flawless scheme that works as long as *everyone* goes through you when doing their reading and writing. I hope that made some sense.
 

Users who are viewing this thread

Back
Top Bottom