I am trying call below function with either of these call routine, but without sucess. Instead of variable FrmName if i use hard coded form name then everything works like it supposed to. I would like to call this funcation from custom toolbar or also from other forms as well. Any thought?
'Check Permission Function Call
Check_Permission Forms!form1
or
Check_Permission (Forms!form1)
Function Check_Permission(FrmName as Form)
'Quick Function Test - remove later
'If Forms!Form1!t55.Value = "6666" Then
'Actual usage
If CurrentUser = "Viewer" Then
Beep
MsgBox "You do not have permission to this item.", vbCritical, "Access Denied"
Exit Function
Else
DoCmd.OpenForm FrmName, acNormal, "", "", , acNormal
DoCmd.GoToRecord acForm, FrmName, acLast
End If
End Function
'Check Permission Function Call
Check_Permission Forms!form1
or
Check_Permission (Forms!form1)
Function Check_Permission(FrmName as Form)
'Quick Function Test - remove later
'If Forms!Form1!t55.Value = "6666" Then
'Actual usage
If CurrentUser = "Viewer" Then
Beep
MsgBox "You do not have permission to this item.", vbCritical, "Access Denied"
Exit Function
Else
DoCmd.OpenForm FrmName, acNormal, "", "", , acNormal
DoCmd.GoToRecord acForm, FrmName, acLast
End If
End Function