D
David
I am useing Win XP and Access 2003.
I have a table called tblAdmins with the users that have full access.
Another table called tblTeamLeads who have some access and then users who can
log data only.
I am using the Dlookup function in conjunction with a feature that gets the
users Windows Login ID. I have the WinIds in the respective tables.
So with that here is the code that I am using:
Private Sub TeamLead_Click()
On Error GoTo Err_TeamLead_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim varUser As Variant
Dim varX As Variant, varXx As Variant
varUser = Get_User_Name()
varX = DLookup("[userid]", "tblAdmins", "userid = " & varUser)
varXx = DLookup(varUser, "tblTeamLeads")
If varUser = varX Or varUser = varXx Then
stDocName = "Team Lead Page"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox ("You are not Authorized to access this page.")
Exit Sub
End If
Exit_TeamLead_Click:
Exit Sub
Err_TeamLead_Click:
MsgBox Err.Description
Resume Exit_TeamLead_Click
End Sub
***************
I keep getting an error of "The expression you entered as a query parameter
produced this error: 'David'"
where David is my windows Id for this example.
I have a table called tblAdmins with the users that have full access.
Another table called tblTeamLeads who have some access and then users who can
log data only.
I am using the Dlookup function in conjunction with a feature that gets the
users Windows Login ID. I have the WinIds in the respective tables.
So with that here is the code that I am using:
Private Sub TeamLead_Click()
On Error GoTo Err_TeamLead_Click
Dim stDocName As String
Dim stLinkCriteria As String
Dim varUser As Variant
Dim varX As Variant, varXx As Variant
varUser = Get_User_Name()
varX = DLookup("[userid]", "tblAdmins", "userid = " & varUser)
varXx = DLookup(varUser, "tblTeamLeads")
If varUser = varX Or varUser = varXx Then
stDocName = "Team Lead Page"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
MsgBox ("You are not Authorized to access this page.")
Exit Sub
End If
Exit_TeamLead_Click:
Exit Sub
Err_TeamLead_Click:
MsgBox Err.Description
Resume Exit_TeamLead_Click
End Sub
***************
I keep getting an error of "The expression you entered as a query parameter
produced this error: 'David'"
where David is my windows Id for this example.