Error trapping date format

mikemaki

Registered User.
Local time
Today, 15:00
Joined
Mar 1, 2001
Messages
81
I have a text box that is formatted to military time. The user does not like the awkward cursor placement that occurs when using an input mask. So I took the mask out. If I enter a value that is not formatted correctly, I receive a microsoft error. I tried to trap the error in the after update event, but the system beats me to it. Where can I trap this error in order to display a more user friendly message?
 
Use the Before Update event instead.
 
The form OnError event
 
dcx693, sometimes the obvious is the hardest answer to find! Thanks.
 
The error takes control before the BeforeUpdate event. I still can't trap it.
 
I'LL TRY AGAIN, YOU HAVE TO USE THE FORM ON ERROR EVENT

Private Sub Form_Error(DataErr As Integer, Response As Integer)
If DataErr = 2113 Then
Response = acDataErrContinue
MsgBox " Wrong value dummy!"
End If
End Sub

you'll have to use the number that corresponds to the error your getting
 
Thanks Rich, I'll try that. I was stuck on the text box error events.
 
Cool, but I don't know if " Wrong value dummy!" qualifies as a "more user friendly message". :D
 
Awkward Cursor Placement

Can use the following on: Got Focus Event:

Code:
Private Sub [FieldNameHere]_GotFocus()
Me.ActiveControl.SelStart = 0
End Sub
This places the cursor at first input point when user tabs to the field. This way you can keep the input mask!!
Just a thought, ignore me if i'm talking tosh!
Phil.
 

Users who are viewing this thread

Back
Top Bottom