LarryDeLaruelle
Technical User
What is the best way to trap for date errors without getting the generic Access Error message?
Right now I am using an unbound text box to accept data entry and using this code in the Before Update event:
Private Sub txtCompDate_BeforeUpdate(Cancel As Integer)
If Not IsDate(txtCompDate) Then
MsgBox "This is not a valid date. Please Reenter", vbOKOnly
Cancel = -1
Else
ProjComp = txtCompDate
End If
End Sub
This works after a fashion but it is still not very user friendly.
Although I have set the Input Mask to Short Date, it does not give me the standard formatting for the user to do data entry (if I bind it to a control I get the generic error).
Nor can I set the value to an empty string or to null to give the user an empty field in which to reenter the date.
How have the gurus handled this situation?
Thanks.
Larry De Laruelle
ldelaruelle@familychildrenscenter.org
Right now I am using an unbound text box to accept data entry and using this code in the Before Update event:
Private Sub txtCompDate_BeforeUpdate(Cancel As Integer)
If Not IsDate(txtCompDate) Then
MsgBox "This is not a valid date. Please Reenter", vbOKOnly
Cancel = -1
Else
ProjComp = txtCompDate
End If
End Sub
This works after a fashion but it is still not very user friendly.
Although I have set the Input Mask to Short Date, it does not give me the standard formatting for the user to do data entry (if I bind it to a control I get the generic error).
Nor can I set the value to an empty string or to null to give the user an empty field in which to reenter the date.
How have the gurus handled this situation?
Thanks.
Larry De Laruelle
ldelaruelle@familychildrenscenter.org