chris01252
Registered User.
- Local time
- Today, 12:29
- Joined
- Feb 27, 2007
- Messages
- 43
I found another thread which answered my question about creating a log in: See Thread
Only problem is I can't seem to get it to work can you please take a look at this line of code and see if you can spot an error, I think this is where it is occuring
The full code is as follows, incase the error is elsewhere
Only problem is I can't seem to get it to work can you please take a look at this line of code and see if you can spot an error, I think this is where it is occuring
Code:
If Me.txtpassword.Value = DLookup("Password", "tblUsers", "[UserID]= """ & txtUserName & """" Then
The full code is as follows, incase the error is elsewhere
Code:
Private Sub cmdLogin_Click()
If IsNull(Me.txtusername) Or Me.txtusername = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.txtusername.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtpassword) Or Me.txtpassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtpassword.SetFocus
Exit Sub
End If
If Me.txtpassword.Value = DLookup("Password", "tblUsers", "[UserID]= """ & txtUserName & """" Then
DoCmd.Close acForm, "frmLogIn", acSaveNo
DoCmd.OpenForm "frmStockControllerSignOff"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtpassword.SetFocus
End If
End Sub