Automatically populate date/time based on user entry

  • Thread starter Thread starter Timothy.Rybak
  • Start date Start date
T

Timothy.Rybak

I have a simple data entry form for my users. When they press OK to
lock in their data, I would like for Access to capture the date/time
and populate a field in the table along with the data from the user. I
assume this will have to be done in VBA. Can anyone help?
 
VBA is not necessary in this instance.
As long as you have a date/time field in your table...
For our example here we will use the date/time field ModifiedDate.
(Quick Note: try not to use reserved words like "Date" for field names.
Access can get confused!)
Anyway, open your form in design mode and add a textbox. Right-click on it
and select Properties. On the Data tab, change the ControlSource to
ModifiedDate (your date/time field).
Then change the Default Value to: =Now()
Then on the Format Tab change the Visible property to No.
What will happen is the field will not be visible to the user. Since they
will not be able to enter anything, the default value of Now() will be
entered. Now() returns the system date like 08/16/2006 07:27:00 AM. When they
move to the next record it should automatically populate the field.

ALTERNATE METHOD: Open the table itself in design mode, alter the field
(your date/time field) and set the Default Value to Now(). Do NOT create the
textbox on the form. Should end up with the same result.

Sorry for being long winded, but again, no VBA is necessary here.

LOL

jmonty
 
This makes good sense... I was trying to make it way to difficult.

Thank you for your help!!!

Tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top