Subform - how to have a default time but only when the record is created (1 Viewer)

Carl_R

Registered User.
Local time
Today, 16:12
Joined
Aug 16, 2002
Messages
82
Hi There,

I have a subform bound to a query. I am timestamping what the user inputs into a field (Activity) so have a field (Time) that has a default value of =Time() formatted to hh:mm:ss.

Unfortunately, it defaults the time even before the Activity record is created so when the person enters an Activity, the time displayed is not correct (because it's already there).

What I would like is for the Time field to be blank. When the person enters text in the Activity field, then (and only then) is the Time field populated.

Not sure how to get around it :confused: so any suggestions greatly appreciated.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:12
Joined
Aug 30, 2003
Messages
36,140
You could use the after update event of the activity control to set the value in the time field, if that's the point you want it (and don't use a field name of "Time", as it conflicts with the Time() function).
 

Carl_R

Registered User.
Local time
Today, 16:12
Joined
Aug 16, 2002
Messages
82
Figured it out.

On BeforeUpdate event of the form Me.[Activity Date] = Now()

This way, if someone advances to the next record or closes the main form, the Activity is still timestamped
 

missinglinq

AWF VIP
Local time
Today, 10:12
Joined
Jun 20, 2003
Messages
6,420
"What I would like is for the Time field to be blank. When the person enters text in the Activity field, then (and only then) is the Time field populated."

You stated the need for the above, but

On BeforeUpdate event of the form Me.[Activity Date] = Now()

will not guarantee that! It will timestamp anytime the record is saved, even if nothing has been entered in the Activity textbox! Paul's suggestion is the only way to

populate the timestamp When the person enters text in the Activity field, (and only then)
 

Users who are viewing this thread

Top Bottom