Code for text box date event

TPugh

New member
Local time
Today, 13:36
Joined
May 6, 2000
Messages
7
Hi
I have a form with two text boxes.
Box1 is for the date, Box2 is a comment.
I want to have an 'on exit' event in Box2 that triggers Box1 to fill with todays date.
This way I will know what day the comment was made.
I am using a macro to do the job now, but I would like to use code.
Thanks
Tom
 
Try using the On Change event for the comment textbox. In here you can say...

[Othertextbox] = Now
This will give the date and time. Or
[Othertextbox] = Date
This will give just the date.
 
It would be better to use the afterupdate property otherwise you'll input date after every key stroke, which will slow your system down.

Mitch.
 
Actually the best Event to use here would be the BeforeInsert Event of the Form. This event fires only the first time the record is created. Two advantages:

1. You don't have to worry about overwriting the value.

2. The date/Time is the time the record was started.

I know most forget this event even exists. I admit I have little use for it but it always comes in handy for these things and if you want to insert a custom ID Number as part of a record.
 

Users who are viewing this thread

Back
Top Bottom