Method or Datamember not found DAO problem?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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!
 
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!
 
Back
Top