Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Non-Existent DLookUp Value

Status
Not open for further replies.

tomco22

Technical User
Sep 16, 2000
74
US
How do I handle nonexistent records with DLookUp? I want to verify that someone is an authorized user before the database opens. My code is:
Code:
Private Sub Authenticator()
If (DlookUp(“[Administrator]”, “[tblUsers]”, “[UserID] = “ & “fOSUserName()”)) = (-1) then
	Open a form
	Exit Sub
End If
Open the “Get Lost” form
End Sub

“Administrator” is a True/False field. “fOSUserName()” is a function that returns the system logged on user name.


Tom
MCSD
I Nab Terrorists
 
If IsNull(DlookUp(“[Administrator]”, “[tblUsers]”, “[UserID] = “ & “fOSUserName()”)) then

HTH,
Bob
 
Thanks Bob.

Tom
MCSD
I Nab Terrorists
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top