Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / November 2007

Tip: Looking for answers? Try searching our database.

Date and time onto a form

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kazlou - 18 Nov 2007 02:47 GMT
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
Allen Browne - 18 Nov 2007 06:01 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> 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
[quoted text clipped - 5 lines]
> Hope that makes sense!
> Kazlou
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.