Forum Discussion
MichaelB200
Oct 01, 2024Copper Contributor
Validating that data was entered into a text Box
I have a Signin form (frmSignIn) with two Text Boxes asking for a UserName (txtName) and Password (txtPassword). The form also has two command buttons Enter (cmdEnter) and Add User (cmdAddUser). ...
arnel_gp
Oct 02, 2024Iron Contributor
MichaelB200, you need also to validate the other textbox. add code to the Click event of cmdEnter:
Private Sub cmdEnter_Click()
If IsNull(txtName) Then
MsgBox "Please provide your username."
Me.txtName.SetFocus
Exit Sub
End If
If IsNull(txtValue)
MsgBox "Please provide your password."
Me.txtValue.SetFocus
End If
End Sub