Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Time Stamp Record @ Entry and again @ Edit

Status
Not open for further replies.

tpearo

Technical User
Apr 24, 2000
124
0
0
US
I've decided to start this new thread because my first thread has gotten a little to long.
I have a table that I use in a database for when an employee submits a sample to a laboratory for analysis I need a time stamp of the date and time submitted. So I have a field name Date and another named Time. I've set the field default values to =Date() and =Time() So when the employee submits the sample I have a record of the submission. Next the laboratory technician needs to input the results of the testing for the same record ex. Accept/Reject so I have a disposition field as a drop down with that criteria. Finally I need a time stamp for when the sample was dispositioned. Both Date and Time. So I have a field named CDATE (Completion Date) and CTIME (Completion Time) I need the system to automatically put the date and time in those two fields when the lab tech selects either accept or reject. Can anyone help?
 
First, please change the names of your fields. Date, Time and CDate are all reserved words in Access and it will end up causing you a LOT of headaches down the road. Next, in the AfterUpdate event for your Accept/Reject field, just add the code
Me.CDate = Date()
Me.CTime = Time()

or you could just use one field and set it to Now() which contains both the date and time.

Paul
 
Paul - I changed the names as you suggested to Compdate and Comptime and placed this code:

Private Sub Dispo_AfterUpdate()
Me.CompDate = Date
Me.CompTIME = Time()

End Sub

Now I get a Compile Error: Method or data member not found.

What am I doing wrong?

Thanks for the help
 
I suppose you could try it without the Me. but technically, that shouldn't make a difference. Do you have the control source for these feilds set to something? Try getting rid of the Me. and see how it goes.

Paul
 
Sometimes when table fields are rename, the form's script does not recognize them--at least in Access 2000 this happens to me all the time. To fix this, open the form in design view, select the value for the form's RecordSource property box and press <Ctrl-X> to cut it out and put on the clipboard, press <Tab> to move the cursor out of the RecordSource property box, press <Shift-Tab> to move the cursor back to the RecordSource field, press <Ctrl-V> to paste it back, and press <Tab> to move the cursor out of the RecordSource field. When the RecordSource is changed and the cursor moves out of the property box, then Access "rescans" the query used for the record source and by magic the VB script editor now "sees" the newly added or newly spelled field.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top