dlookup problem
Hi,
My code to verify code/password on my form is:
'Match txtregioncode & txtpassword in the passwords file
If DLookup("password", "Passwords", "RegionCode=" & Me![txtRegionCode]) <> Me!txtPassword Then
MsgBox "Wrong region code/password combination, try again.", vbExclamation, "PASSWORD REQUIRED"
Else
DoCmd.Close acForm, "Passwords"
stDocName = "Menu"
DoCmd.OpenForm stDocName
Call DisableOption
End If
The problem with the lookup is that INVALID region codes are valid. But I thought the way I phrased my dlookup above I thought an invalid region code was covered. Why? Because I only extract a password when the control region code value & table value are the same & then match the records password with the control password & display a message if wrong.
Any thoughts?
Thanks!
Hi,
My code to verify code/password on my form is:
'Match txtregioncode & txtpassword in the passwords file
If DLookup("password", "Passwords", "RegionCode=" & Me![txtRegionCode]) <> Me!txtPassword Then
MsgBox "Wrong region code/password combination, try again.", vbExclamation, "PASSWORD REQUIRED"
Else
DoCmd.Close acForm, "Passwords"
stDocName = "Menu"
DoCmd.OpenForm stDocName
Call DisableOption
End If
The problem with the lookup is that INVALID region codes are valid. But I thought the way I phrased my dlookup above I thought an invalid region code was covered. Why? Because I only extract a password when the control region code value & table value are the same & then match the records password with the control password & display a message if wrong.
Any thoughts?
Thanks!