I have a login form that has :
"txtUsername"
"txtPassword"
It linked to table:"tblUsers" that contain a filed "UserName"
I set a form filter to filter the "UserName" like "txtUsername"
Everything works fine if the typed username already exists in "tblUsers" but if the typed username doesn't match "UserName" filed after filed, I get and error and even the form goes blank;
I want the form to set error Msg that username is not correct.
Here the code I use
"txtUsername"
"txtPassword"
It linked to table:"tblUsers" that contain a filed "UserName"
I set a form filter to filter the "UserName" like "txtUsername"
Everything works fine if the typed username already exists in "tblUsers" but if the typed username doesn't match "UserName" filed after filed, I get and error and even the form goes blank;
I want the form to set error Msg that username is not correct.
Here the code I use
Code:
Private Sub txtUsername_AfterUpdate()
Me.Form.Filter = "UserName like '*" & Me.txtUsername & "*'"
Me.Form.FilterOn = True
Me.txtPassword.SetFocus
End Sub