date created no prob, date updated big headache

pjlapham
03-06-2001, 03:55 AM
I hope VBA stands for VBAccess. Let me know and I'll post elsewhere if i need to.

MSAccess: when a record is created i'm using simple default value = date() for the 'date created' field. But how do I get the 'date updated' field to be updated when any part of the record is updated? which event do I use? what event procedure would I use? in table definition? in form properties?
I figure this is super simple. the VB help files are more torment than anything else.
Thanks for your help!

PWNettle
03-06-2001, 01:07 PM
VBA stands for VB for Applications. Access is one of those applications.

One thing you could do is set your 'date updated' field to Date() whenever a record is modified. If you had your data bound to a form you could put some code in the 'BeforeUpdate' event of the form to do this. You'd need the 'date updated' field to be bound to a textbox on your form but you could make it invisible (set Visible to False) because your user doesn't need to see this field. Your form's BeforeUpdate event would end up looking something like:
<pre>Private Sub Form_BeforeUpdate(Cancel As Integer)

[DateUpdated] = Date ' Change to whatever you're calling your 'date updated' field/textbox.

End Sub</pre>

I can post a tiny sample database if this isn't clear enough.

Hope this helps,
Paul

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum