Hi,
I need some help in regards to a dlookup problem I have, I have a switchboard which has 2 buttons, I'm trying to set-up the "Admin" Button to only load if a user is an admin. i've setup a table (tblUsers) which has 3 fields (UserID,Displayname and Group) the userid field is based on the default value fOSUserName() function, the Display name is the users real name (just for display purposes) and the Group will have either Admin or User as the value.
i've got a code which i'm trying to use on click of the admin button but keep getting a runtime error '2471'
the expression you entered as a query parameter produced this error: 'h06849962'
h06849962 is the admin's UserID and i'm trying to allow them to access the form as the group value is "Admin"
the code i'm using is:
i found the above code on the net and can't seem to get it to work, any help would be appreciated
I need some help in regards to a dlookup problem I have, I have a switchboard which has 2 buttons, I'm trying to set-up the "Admin" Button to only load if a user is an admin. i've setup a table (tblUsers) which has 3 fields (UserID,Displayname and Group) the userid field is based on the default value fOSUserName() function, the Display name is the users real name (just for display purposes) and the Group will have either Admin or User as the value.
i've got a code which i'm trying to use on click of the admin button but keep getting a runtime error '2471'
the expression you entered as a query parameter produced this error: 'h06849962'
h06849962 is the admin's UserID and i'm trying to allow them to access the form as the group value is "Admin"
the code i'm using is:
Code:
Private Sub openadmin_Click()
If DLookup("Group", "tblUsers", "UserID =" & fOSUserName) <> Admin Then
MsgBox "You have insufficient rights to open the Admin Form"
Cancel = True
End If
i found the above code on the net and can't seem to get it to work, any help would be appreciated
