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
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