dlookup problem

arage

Registered User.
Local time
Today, 04:39
Joined
Dec 30, 2000
Messages
537
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!
 
never mind i seem to have cleared it
smile.gif


for now...muhahahha!!
wink.gif
 
Sure?

Sugg:

If DLookup(....)=Me!txtPassword then
' nothing
Else
msgBox ....
End If

(DLookup returns NULL when not found, which is always interpreted as False!)
 

Users who are viewing this thread

Back
Top Bottom