Form Access Restrictions MulitUser Database (1 Viewer)

Pauline123

Registered User.
Local time
Today, 06:32
Joined
Apr 1, 2013
Messages
69
Hi, hope someone can help - I am trying to restrict access to users to prevent Level 1 users from gaining access to all the workings eg tables, queries and forms.

I have a security table and a login form which brings each user to a specified switchboard showing command buttons to specific forms.

But I cannot figure out a way to stop them from closing the switchboard and therefore gaining access to the entire database including the forms etc they are not allowed to access.

I have tried using the Pop Up function but when the command buttons are activated to open the selected form it opens behind the switchboard.

If I do set the switchboard so new forms open the user can still gain access to areas of the database.

Did try VBA coding as follows in the On Load event of a form:
If Forms!frmLogin!cboUser.Column(4) <> 1 Then
MsgBox “You are not authorized to open this form!”, vbOkOnly
DoCmd.Close acForm, “Customers Orders”
End If

But it failed to work - kept saying could not find the frmLogin form but this is present in my database.

Tried:
If Forms!frmLogin!cboUser.Column(4) <> 1 Then
DoCmd.Close acForm, Me.Customers Orders
MsgBox “You are not authorized to open this form!”, _
vbCritical, "Security Violation"
End If

but again it either said it could not find the Login form or had trouble with the form Customers Orders

Can anyone help me out - this is the final stage of completing my database.

Pauline :)
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:32
Joined
Aug 30, 2003
Messages
36,126
The login form has to be open when this code runs; is it? You can hide it, but it has to be open. The syntax to close in the second example is wrong.
 

Pauline123

Registered User.
Local time
Today, 06:32
Joined
Apr 1, 2013
Messages
69
Hi Paul, no the login form closes when the user logs in - the coding is:

Private Sub Exitcmd_Click()
On Error GoTo Err_Exitcmd_Click

DoCmd.Close
Exit_Exitcmd_Click:
Exit Sub
Err_Exitcmd_Click:
MsgBox Err.Description
Resume Exit_Exitcmd_Click

End Sub

Can you help me solve this problem :)

Many thanks
Pauline
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:32
Joined
Aug 30, 2003
Messages
36,126
Me.Visible = False
 

Pauline123

Registered User.
Local time
Today, 06:32
Joined
Apr 1, 2013
Messages
69
Hi thanks for the tip - have solved the problem so thank you for taking time out to help.

Pauline :)
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 22:32
Joined
Aug 30, 2003
Messages
36,126
Happy to help!
 

Users who are viewing this thread

Top Bottom