Link to home
Start Free TrialLog in
Avatar of runnerjosh2k
runnerjosh2k

asked on

Access Dlookup Help

Im using Dlookup to validate user info when someone uses my database.
I have a table that has fields for name, windows logon, access level, and manager
I am trying to use dlookup to return the manager of the name typed in to some text boxes but i keep getting an error.  

here is my code:

Dim fullName As String
Dim manager As String

DoCmd.GoToControl "txtFirstName"
fullName = Me.txtFirstName.Text
DoCmd.GoToControl "txtLastName"
fullName = fullName & " " & Me.txtLastName.Text

manager = DLookup("[Manager]", "Access", "[First_Name] = " & fullName)

when it runs i get a syntax error 3075 - missing operator
Avatar of Rick_Rickards
Rick_Rickards
Flag of United States of America image

manager = DLookup("[Manager]", "Access", "[First_Name] = '" & Replace(fullName,"'","''") & "'"
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial


manager = DLookup("[Manager]", "Access", "[First_Name] = '" &Me.txtFirstName &"'")


manager = DLookup("[Manager]", "Access", "[First_Name] = '" & Me.txtFirstName &"' and [Last_name]='" & Me.txtLastName &"'")
Avatar of runnerjosh2k
runnerjosh2k

ASKER

Thanks for the help...I know it looks wierd putting a variable fullName into a field named First_Name but that is just because i revised my table but havent changed some of the field names to make them more accurate.