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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Generating an automatic date and time 1

Status
Not open for further replies.

PenelopePitstop

Technical User
Jul 15, 2004
14
GB
I have a small database which records faults.
When the fault is closed the technician selects their name from a combo box displayed on a form.
On completion of this action how can I then generate an automatic time and date in the next two subsequent fields.

Any help appreciated.
Penelope
 
You can do it in one field with Now() but remember to lock the field after it has data in

Hope this helps
Hymn
 
Not much help I'm afraid; can you elaborate on Now ().
Need the specific code I'm afraid.
Penelope
 
In the BeforeInsert event procedure of the form, add something like this:
Me![name of control bound to DateTimeStamp field] = Now()

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks PHV, getting closer but not quite there yet.

I have three fields:
[ClearedBy] A combo with a list of names
[ClearedDate] Set to date/time with input mask
[ClearedTime] Set to date/time with input mask

When the user exits from [ClearedBy] I would like the [ClearedDate] and [ClearedTime] to be automatically populated.

Do I need to put the event procedure in the BeforeUpdate and specify both the date and time fields.

Hope you can help.
Penelope
 
Penelope
By using Now() you only need one field
Now()will give date and time in one field

In your table for cleared date make the
format = General date
default value = Now()

Hope this helps
Hymn
 
Thanks Hymn,

I tried that but it generated the date/time in the next new record which isn't quite what I'm after.
I want the date/time to be generated only after the 'Clearedby' combo has been populated.
Any further suggestions greatly appreciated.
Regards
Penelope
 
In the After Update event of 'clearedby' combo
Me!Cleareddate = Now()

Will give you the date and time in the 'cleareddate' control

Hope this helps
Hymn
 
Have a Question on "but remember to lock the field after it has data in" written by hymm. I would like to do the same thing as Penelope but need to know how to lock the record that was updated. I have a Table that has 4000 plus clients info and would like a date updated field. If I add the now() what does the lock have to do with it. Is this a function of the "Tools" "Options" "Advanced" record locking? thanks for any of your help
 
jonhimes
if not isnull(Me![YourFieldName]) then
YourFieldName.Locked = True
End if


Hope this helps
Hymn
 
HYMN,

Thankyou for your help. That worked perfectly.
Here's my own vote
"**********"
My appreciation once again.
Penelope
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top