Method or Datamember not found DAO problem?

J

JAdams

I am not sure what is wring with my code. The code is to set permissions based on user type.


Sub Permissions()
Dim usr, grp
usr = Me.user
grp = DLookup("[Type]", "Users", "[UserName] = " & "'" & usr & "'")
DoCmd.Close
DoCmd.OpenForm "mnuMenu"
Forms!frmIntegrity!txtUser = usr
Forms!frmIntegrity!txtType = grp
If grp = "Admin" Then
Forms!mnuMenucmdAddUser.active = True
ElseIf grp = "User" Then
Forms!mnuMenu!cmdAddUser.active = False
End If

End Sub

Thanks in advance!
 
W

Wayne Morgan

Forms!mnuMenucmdAddUser.active = True
ElseIf grp = "User" Then
Forms!mnuMenu!cmdAddUser.active = False

There is a typo in the first line, missing ! after the form name. Also, I
believe .active should be .Enabled. Also, you are setting usr=Me.user.
Unless you have a textbox called "user", this won't work. Are you looking
for Application.CurrentUser?

--
Wayne Morgan
MS Access MVP


JAdams said:
I am not sure what is wring with my code. The code is to set permissions based on user type.


Sub Permissions()
Dim usr, grp
usr = Me.user
grp = DLookup("[Type]", "Users", "[UserName] = " & "'" & usr & "'")
DoCmd.Close
DoCmd.OpenForm "mnuMenu"
Forms!frmIntegrity!txtUser = usr
Forms!frmIntegrity!txtType = grp
If grp = "Admin" Then
Forms!mnuMenucmdAddUser.active = True
ElseIf grp = "User" Then
Forms!mnuMenu!cmdAddUser.active = False
End If

End Sub

Thanks in advance!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top