By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,296 Members | 1,472 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,296 IT Pros & Developers. It's quick & easy.

How to fill the "LastUpdate" field automatically?

P: 2
Hi,

I have two fields in my Table - "ID" and "LastUpdate" and i want the "LastUpdate" field to be updated with the current date and time whenever i make any changes to the field "ID" or add a new ID. Can someone kindly support me with this?
I am extremely new to MS Access and have a poor VB knowledge hence, would be great if someone can give me a detailed process...

Sheela
Dec 21 '09 #1
Share this Question
Share on Google+
3 Replies


Expert 100+
P: 636
Hi

Assuming that the records are added and updated in a Form then
perhaps something like this
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_BeforeUpdate(Cancel As Integer)
  2.     [LastUpdate]=Now()
  3. End Sub
??


MTB
Dec 21 '09 #2

P: 2
Hi Mike,

thanks for the quick reply.. however I update the ID directly into the table and not by using forms.
Dec 23 '09 #3

missinglinq
Expert 2.5K+
P: 3,532
Then you're out of luck! Data should never be entered directly into a table!

Go to Forms in the database window, click on Create form by using Wizard and follow the Wizard's instruction to create a form based on your table. Then, from Form Design View, go to the View Menu and click on Code. Paste in Mike's code and you should be set.

Welcome to Bytes!

Linq ;0)>
Dec 23 '09 #4

Post your reply

Sign in to post your reply or Sign up for a free account.