Dlookup criteria

action

Registered User.
Local time
Tomorrow, 03:57
Joined
May 29, 2003
Messages
89
I am fairly new to writing code and have been unable to work out the criteria to set for the following Dlookup.

I am trying to check the level of a user id before they log in using the afterupdate event. I want to look at the level for the user id that they input, I think it can be done with dlookup but unsure.

Basically I need the code to look at the [Employee ID] then the [level] and reject any under the level 50.



Private Sub TXTEmployeeidentry_AfterUpdate()
Dim srchResult As Variant

srchResult = DLookup("[level]", "Employee", ???????)
If (srchResult) <= 50 Then
MsgBox ("You do not have password access for this function.")
Me.TXTEmployeeidentry = Null
Me.TXTPasswordentry = Null
Me.TXTEmployeeidentry.SetFocus
Exit Sub
End If

End Sub


PS I have elected to not use access security
 
srchResult = DLookup("[level]", "Employee", "[user_id] = '" & me!TXTEmployeeidentry & "'")

Thats assuming user_id is a text field...
 
thanks

worked a treat, thanks..
 

Users who are viewing this thread

Back
Top Bottom