ChrisLayfield
Registered User.
- Local time
- Today, 07:19
- Joined
- May 11, 2010
- Messages
- 55
When the user logins in, I have a value in the profile to determine their access to the database. I edited out the code that doesn't apply
This part works and in this same form there is a code to open the desired menu
But somewhere between here and a submenu of the user menu, the variable strUSerAccess loses its value...to that on a submenu I get an error that it needs a method or form name because strUserAccess ="" for some reason.
Code:
Option Compare Database
Public strUserID As String
Public strUserAccess As String
'------------------------------------------------------------
' cbxEmployeeID_AfterUpdate
'
'------------------------------------------------------------
Public Sub cbxEmployeeID_AfterUpdate()
strUserID = Forms!frmNCSLogin.cbxEmployeeID
strUserAccess = Nz(DLookup("dbAccess", "tbl_Employees", _
"tbl_Employees.EmployeeID = '" & strUserID & "'"), "NoAccess")
End Sub
This part works and in this same form there is a code to open the desired menu
Code:
'------------------------------------------------------------
' cmdEnter_Click
'
'------------------------------------------------------------
Private Sub cmdEnter_Click()
DoCmd.OpenForm strUserAccess, acNormal
End Sub
Code:
'------------------------------------------------------------
' cmdMainMenu_Click
'
'------------------------------------------------------------
Private Sub cmdMainMenu_Click()
On Error GoTo cmdMainMenu_Click_Err
On Error Resume Next
DoCmd.Close acForm, "menuPersonel", acSaveNo
If strUserAccess <> "menuAdmin" Then
DoCmd.OpenForm strUserAccess, acNormal, acReadOnly
End If
If (MacroError <> 0) Then
Beep
MsgBox MacroError.Description, vbOKOnly, ""
End If
cmdMainMenu_Click_Exit:
Exit Sub
cmdMainMenu_Click_Err:
MsgBox Error$
Resume cmdMainMenu_Click_Exit
End Sub