Dlookup Issue

thmsjlmnt3953

Registered User.
Local time
Today, 10:01
Joined
May 20, 2014
Messages
120
Hi

I'm using the following to get a users id number once they login - that part the first line works. however now i want to use that number to check in the permissions table to see if there is a tick in the 'EnterTrade' field and if not then do some action however i cant seem to get it tot work

Code:
'return user id to check permissions
EmpIDLogin = DLookup("[empid]", "tblemployee", "[userid] ='" & Me.txtUserID.Value & "'")
If DLookup("[EnterTrade]", "tblpermissions", "[empID] ='" & EmpIDLogin & "'") = -1 Then 'somefunction
 
cant seem to get it to work
For best troubleshooting results, provide symptoms of the failure, for instance, you get an compile error, runtime error, silent failure, wrong result, etc..., etc... We know it doesn't work, or you wouldn't post. :)
 
Code:
EmpIDLogin = DLookup("[empid]", "tblemployee", "[userid] ='" & Me.txtUserID.Value & "'")

The expression you entered as a query parameter produced this error.

What im trying to achieve is that each user has a tick against what cmdbutton they can access on the nav form. so i can add and take away privelages without having to code each person individually.

So there is one dlookup to find the empid then a dlookup for each button to see if they should have access, if so then forms!form!ctrl.enabled
 
I thought the first part worked? Isn't this the first part?
Code:
EmpIDLogin = DLookup("[empid]", "tblemployee", "[userid] ='" & Me.txtUserID.Value & "'")
The expression you entered as a query parameter produced this error.
Sorry, what error is that?
 
apologies its this part that fails

Code:
If DLookup("[EnterRecords]", "tblpermissions", "Criteria= '" & EmpIDLogin & "'") = -1 Then
Forms!frmnavigation!cmdNavEnterRecords.Enabled
End If
 
Consider describing the symptoms of the failure.
 

Users who are viewing this thread

Back
Top Bottom