G
gaugust
In Access 2003 I would like to validate an incomplete form when then user
closes the form and allow the user to correct missing field data. What is
happening is that the "No Current Record" error appears when the DoCmd.Close
is triggered in the click event for the form's close button. In the form's
unload event I have the following code:
'Validate date and time
If IsNull(Me.Date) Then
If MsgBox("Unload - Date is missing, if not corrected data will not
be saved, Do you want to enter a date?", vbYesNo, "Missing Date") = vbYes Then
Cancel = True
Me.Date.SetFocus
End If
ElseIf IsNull(Me.Time) Then
If MsgBox("Unload - Time is missing, if not corrected data will not
be saved, Do you want to enter a time?", vbYesNo, "Missing Time") = vbYes Then
Cancel = True
Me.Time.SetFocus
End If
End If
If the Date field on the form is missing and the user selects "Yes" in the
message box the cancel works and the focus is placed on the Date field, but
the error message "No current Record" also shows. How can I get rid of the
error message?
Thanks!
closes the form and allow the user to correct missing field data. What is
happening is that the "No Current Record" error appears when the DoCmd.Close
is triggered in the click event for the form's close button. In the form's
unload event I have the following code:
'Validate date and time
If IsNull(Me.Date) Then
If MsgBox("Unload - Date is missing, if not corrected data will not
be saved, Do you want to enter a date?", vbYesNo, "Missing Date") = vbYes Then
Cancel = True
Me.Date.SetFocus
End If
ElseIf IsNull(Me.Time) Then
If MsgBox("Unload - Time is missing, if not corrected data will not
be saved, Do you want to enter a time?", vbYesNo, "Missing Time") = vbYes Then
Cancel = True
Me.Time.SetFocus
End If
End If
If the Date field on the form is missing and the user selects "Yes" in the
message box the cancel works and the focus is placed on the Date field, but
the error message "No current Record" also shows. How can I get rid of the
error message?
Thanks!