Date and time onto a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I am designing a form that my client would like the date and time
automatically recorded in a field and stored so that when they refer back it
shows when the record was done. The 'NOW' function only shows the current
date & time and keeps updating. Is there a way of putting the 'NOW' value
into a field, then locking it so it doesn't change when the record is
reopened.
Hope that makes sense!
Kazlou
 
The form stores data in a table. You need to add a date/time field to your
table to record the date and time a record was last updated.

1. Open the table in design view.

2. Add a new field named (say) LastUpdate, type Date/Time.

3. Save and close the table.

4. Open your form in design view.

5. In the Properties sheet, set the Before Update property of the form to:
[Event Procedure]
Note: Make sure the title bar of the Properties sheet says "Form."
It won't work if you set the property of a text box.

6. Click the Build button (...) beside the property.
Acess opens the code window.
Set up the code like this:
Private Sub Form_BeforeUpdate(Cancel As Integer)
Me.[LastUpdate] = Now()
End Sub
 

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