Access MS Access require a value when updating a record

Joined
Oct 20, 2009
Messages
1
Reaction score
0
I have a form that has data with some blank fields that must be updated. There is a date of birth field that must be updated. I am using the set focus to activate the field and lost focus to make sure a date is entered. If not I want to set the focus back to the field it displays the msg but allways goes to the next field. Here is the code I am trying.
HELP!
____
Private Sub Birthdate_LostFocus()
On Error GoTo Err_Birthdate_LostFocus

xdob = [Birthdate] & ""
If [xdob] = "" Then
strMsg = "You must enter a date of birth!"
MsgBox strMsg, vbExclamation, "Error"
Me.Birthdate.SetFocus

Else

End If
Exit_Birthdate_LostFocus:
Exit Sub
Err_Birthdate_LostFocus:
MsgBox Err.Description
Resume Exit_Birthdate_LostFocus

End Sub
_____

Solved problem by adding this to the onenter of the subforms! and adding cancel = true statement after the setfocus.
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top