How to find record in table and use one of its field for an if statement

behnam

Registered User.
Local time
Yesterday, 20:53
Joined
Jun 3, 2014
Messages
13
Hi guys,

I have a table called login and inside that table is three columns: username, password and admin. I have the username saved in a global variable called GsUser. How can i find the record in that table with the same Username as the string stored in GsUser and use that record for an if statement which sees if the value of the admin column is "Yes". Im trying to do it using VBA. Im not using a form where everything is bounded. Thanks.​
 
Try using the DLookup function.

regards
Dave
 
You can simply use a DLookup to get the value.
Code:
someVariable = Nz(DLookup("admin", "login", "username = ' & GsUser & '"), False)
 

Users who are viewing this thread

Back
Top Bottom