User Access Control

B

Bill

I am using the GBL_Access_Level script (Gobals) and I am getting the error of:

error Ambiguous name detected: set_access

On the following sub:

Private Sub Form_Open(Cancel As Integer)
Dim ntlogin As String
Init_Globals ' initialize the global variables
ntlogin = Environ("Username") ' get the username of person logged into
computer
GBL_Access_Level = Nz(DLookup("Access_Level", "L_Users", "UserName='" &
ntlogin & "'"), "None") ' lookup the access level in our users table
set_access (GBL_Access_Level) ' call the function to set the security on
the tabs and forms

It verifies using the script:
Option Compare Database

Global GBL_Access_Level As String

Public Function Init_Globals()
GBL_Access_Level = "None"
End Function

Public Function Get_Global(gbl_parm)
Select Case gbl_parm
Case "GBL_Access_Level"
Get_Global = GBL_Access_Level
End Select
End Function

Somehow I started getting an error when I added a new user level. I've
added and changed user levels in the past with no problems, but something I'm
doing now is giving me a major headache!!! Now when it verifies user, I get
this error and I cant figure out why. Any help is MUCH appreciated.

Thank you,

Bill
 
C

Chris O'C via AccessMonster.com

set_access is defined more than once in your db. Find all occurences in the
vba modules and decide which function you want to keep. Delete all the
others.

Chris
 
C

Chris O'C via AccessMonster.com

I just noticed you have Option Compare Database in your module, but you're
missing Option Explicit. Add Option Explicit at the top of every vba module,
save and compile. Change the editor setting so it automatically puts Option
Explicit at the top of every new module you create.

Chris
 
B

Bill

Chris, thanks for the assistance. I searched for all instances of
"set_access" and see it is listed twice. Once in the script I copied below
and the other in the verification of access rights for each user. I've
copied the 2nd below. I've added the Option Explicit to the top and tried to
compile but no such luck. Thanks for your help. Bill

------------ Additional VBA ---------
Option Explicit
Option Compare Database

Function set_access(level As String)

Select Case level
Case "None"
Form_IR_Main.TabCtl76.Pages.Item(0).Visible = False ' sets the
Students tab invisible for access=None
Form_IR_Main.TabCtl76.Pages.Item(1).Visible = False ' sets the
Students tab invisible for access=None
Form_IR_Main.TabCtl76.Pages.Item(2).Visible = False ' sets the
Students tab invisible for access=None
Case "Edit"
Form_IR_Main.TabCtl76.Pages.Item(7).Visible = False ' sets the
Students tab invisible for access=None
Form_IR_Main.TabCtl76.Pages.Item(8).Visible = False ' sets the
Students tab invisible for access=None
Form_IR_Main.TabCtl76.Pages.Item(9).Visible = False ' sets the
Students tab invisible for access=None
Case "Read"
Form_IR_Main.Visible = True ' sets the Students tab invisible for
access=None
Form_IR_Main.AllowEdits = False
Form_IR_Main.AllowAdditions = False
Form_IR_Main.AllowDeletions = False
Form_IR_Main.TabCtl76.Pages.Item(0).Visible = True ' sets the
Students tab invisible for access=None
Form_IR_SUB_Subjects_Info.AllowEdits = False
Form_IR_SUB_Subjects_Info.AllowAdditions = False
Form_IR_SUB_Subjects_Info.AllowDeletions = False
Form_IR_Main.TabCtl76.Pages.Item(1).Visible = True ' sets the
Students tab invisible for access=None
Form_IR_Sub_Police.AllowEdits = False
Form_IR_Sub_Police.AllowAdditions = False
Form_IR_Sub_Police.AllowDeletions = False
Form_IR_Main.TabCtl76.Pages.Item(2).Visible = True ' sets the
Students tab invisible for access=None
Form_IR_Sub_General_Liability.AllowEdits = False
Form_IR_Sub_General_Liability.AllowAdditions = False
Form_IR_Sub_General_Liability.AllowDeletions = False
Case "Admin"
Form_IR_Main.TabCtl76.Pages.Item(7).Visible = True ' sets the
Students tab invisible for access=None
'Form_FollowupNotes.AllowEdits = True
'Form_FollowupNotes.AllowAdditions = True
'Form_FollowupNotes.AllowDeletions = True
Form_IR_Main.TabCtl76.Pages.Item(8).Visible = True ' sets the
Students tab invisible for access=None
Form_frmEditSystemMessages.AllowEdits = True
Form_frmEditSystemMessages.AllowAdditions = True
Form_frmEditSystemMessages.AllowDeletions = True
End Select
End Function
 

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