David R
I know a few things...
- Local time
- Yesterday, 21:05
- Joined
- Oct 23, 2001
- Messages
- 2,633
I must be rusty, because this seems like the simplest thing in the world.
I have date fields on my new form. Data validation requires them to have a 'time' associated with them. I thought I could trap if they had left the time portion blank and insert the current time of day, rather than forcing them to go back to the field and re-enter it (these are not power users).
Default = Now() won't work because they might be backdating.
http://office.microsoft.com/en-us/access/HA102389881033.aspx#1 says that BeforeUpdate is the earliest event that fires when you start to save a field/record; but that's too late (Error 2115). Someone in an earlier thread suggested OnLostFocus but that happens even later. The OnChange event happens on every keystroke. What am I missing??
I have date fields on my new form. Data validation requires them to have a 'time' associated with them. I thought I could trap if they had left the time portion blank and insert the current time of day, rather than forcing them to go back to the field and re-enter it (these are not power users).
Code:
'first put in a time of day if they forgot to do so
If Me.CaseAwarded.Value = Date And Hour(Me.CaseAwarded.Value) = 0 Then Me.CaseAwarded.Value = Now()
http://office.microsoft.com/en-us/access/HA102389881033.aspx#1 says that BeforeUpdate is the earliest event that fires when you start to save a field/record; but that's too late (Error 2115). Someone in an earlier thread suggested OnLostFocus but that happens even later. The OnChange event happens on every keystroke. What am I missing??