Hi im trying to get my dlookup code to work but can get it to.
I have create a blank form with a username and password box i have a table called staff in it i have a column called staff password and staffusername and issales(yes/no)
my code is as follows but gives me an error on the dlookup.
getpass = DLookup("StaffPassword", "[staff]", "[StaffUserName] =" & [me.frmusername])
issales = DLookup("[staffissales]", "[staff]" = "Me.frmusername")
If Me.frmpassword <> getpass Then
MsgBox "Your Username or password is incorrect. Access Denied"
Me.frmpassword = ""
Me.frmpassword.SetFocus
Exit Sub
End If
If issales = True Then
Dim userform As String
Dim stLinkCriteria1 As String
userform = "Sales main menu"
DoCmd.Close acForm, "[login]", acSaveYes
'Close Form
'acSaveYes saves any changes to the form without prompting
DoCmd.openform userform, , , stLinkCriteria1
I have create a blank form with a username and password box i have a table called staff in it i have a column called staff password and staffusername and issales(yes/no)
my code is as follows but gives me an error on the dlookup.
getpass = DLookup("StaffPassword", "[staff]", "[StaffUserName] =" & [me.frmusername])
issales = DLookup("[staffissales]", "[staff]" = "Me.frmusername")
If Me.frmpassword <> getpass Then
MsgBox "Your Username or password is incorrect. Access Denied"
Me.frmpassword = ""
Me.frmpassword.SetFocus
Exit Sub
End If
If issales = True Then
Dim userform As String
Dim stLinkCriteria1 As String
userform = "Sales main menu"
DoCmd.Close acForm, "[login]", acSaveYes
'Close Form
'acSaveYes saves any changes to the form without prompting
DoCmd.openform userform, , , stLinkCriteria1