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

Hidden Date and time stamp?

P: 283
I am wondering how do I create a hidden date stamp and I could also add a time stamp if I wanted to. So what would happen is once information is entered in to a form and then saved I want to make it so on the table it auto populates a column with todays date.

I feel like an idiot asking what im sure is very simple problems.

I really apperciate all the help from everyone out there has been giving me.
Mar 8 '10 #1
Share this Question
Share on Google+
7 Replies

Expert 100+
P: 1,134
an information cahnge on any field of the form or on a particular field on the form.

Either way you need to add VB code to an appropriate event
AfterUpdate on the form or control for example.

The code changes the hidden controls value like so
Expand|Select|Wrap|Line Numbers
  1. txtHiddenDate=Now()
Mar 8 '10 #2

Expert Mod 15k+
P: 31,186
Now() gives both date & time. Date() & Time() functions are also available if required.
Mar 8 '10 #3

P: 283
Ok i got it to work sort of. Now im getting and error saying " I can not go to the specified record"

Any idea why its doing that? I just want to save the record and go on to the next one. Do i need to add in a DoCmd,update Record command??
Mar 8 '10 #4

Expert Mod 100+
P: 2,321
I would put the code by Delerna in the BeforeUpdate of the Form.

If you want us to help with debugging your need to provide the code.
Mar 8 '10 #5

Expert 2.5K+
P: 3,532
I agree with Smiley. The Form_AfterUpdate is too late to add data to the record, Form_BeforeUpdate is the place to assign this value.

And no, Access will automatically save the record when you move to another record or close the form.

Linq ;0)>
Mar 8 '10 #6

P: 283
Ok I finally got this to work with way a lot of playing around and actually found out there are 2 ways to do this.

First off the code provided by Delerna is only part of it. What I had to do was first set the beforeUpDate data to txtHiddenData = Now() Then I had to create a hidden box and set the beforeUpDate on that box to =Int (Now()) and presto it finally worked with out any errors giving me both the time and date in the table.

Also I figured out another way to get this to work as well but only gave me the date. What you can do is create a hidden box set it to a table then set the Defult Value under the Data tab to =Int (Now()) and that will also give you the date each time you save.

Thank you so much to everyone really apperciate all the help. Im sure i will be back with some new questions before to long.

Thanks again :)
Mar 8 '10 #7

Expert Mod 15k+
P: 31,186
Slenish, you're not explaining yourself very clearly. I'm still unclear on whether you are looking for a date stamp, a date & time stamp or two separate stamps for date & time.

Whatever it is you do want, using Int(Now()) in place of the more logical Date() is not a good idea (See post #3). It doesn't make your code easy to read or maintain.

I tried to understand what you were on about when you were talking about creating a new hidden 'box' on your form, but I couldn't make any sense of it, and I couldn't imagine why you felt it was necessary.
Mar 10 '10 #8

Post your reply

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