Hello Again,
I am doing some test on my project, that's why I have a few posts going. With this one. I am trying to make sure the user puts in all the required fields on my form. For each field that is required, I have this code.
Private Sub FirstName_LostFocus()
I realize that a person could just click into any field and miss the event, so I have several statements in the Save Button code that checks all the required fields.
When I tab over the field, it does show the message, but it doesn't set the focus back on the field.
This is probably an easy fix. I haven't tested the Save button yet, but if anyone foresees an issue, let me know, please.
Thanks
I am doing some test on my project, that's why I have a few posts going. With this one. I am trying to make sure the user puts in all the required fields on my form. For each field that is required, I have this code.
Private Sub FirstName_LostFocus()
If IsNull(Me.FirstName) Then
MsgBox "You must enter a Name."
Me.FirstName.SetFocus
Else
Me.MiddleInitial.SetFocus
End If
End Sub
MsgBox "You must enter a Name."
Me.FirstName.SetFocus
Else
Me.MiddleInitial.SetFocus
End If
End Sub
I realize that a person could just click into any field and miss the event, so I have several statements in the Save Button code that checks all the required fields.
If IsNull(Me.FirstName) Then
MsgBox "You must enter a Name.", vbOKOnly
Me.FirstName.SetFocus
Else
End If
MsgBox "You must enter a Name.", vbOKOnly
Me.FirstName.SetFocus
Else
End If
When I tab over the field, it does show the message, but it doesn't set the focus back on the field.
This is probably an easy fix. I haven't tested the Save button yet, but if anyone foresees an issue, let me know, please.
Thanks