Hello
I have some code on a login form that I can login as a admin and it will display all of the tables and queries, modules etc in access for me
But Im trying to hide all of this when another user logs in.
What I cant hide is the options where a user could potentially unhide the ribbon
I create a .accde file format as my final access database. Here is my code:
ption Compare Database
Private intLogonAttempts As Integer
Private Sub Form_Load()
LimitAccess
Me.cboEmployee.SetFocus
End Sub
Private Sub cboEmployee_AfterUpdate()
'After selecting user name set focus to password field
Me.txtPassword.SetFocus
End Sub
Private Sub cmdLogin_Click()
'Check to see if data is entered into the UserName combo box
If IsNull(Me.cboEmployee) Or Me.cboEmployee = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.cboEmployee.SetFocus
Exit Sub
End If
'Check to see if data is entered into the password box
If IsNull(Me.txtPassword) Or Me.txtPassword = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tbl_Employees to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("Password", "tbl_Employees", "[UserID]=" & Me.cboEmployee.Value) Then
'Start Main Application Code
StartApp (Me.cboEmployee.Value)
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 3 Then
MsgBox "You do not have access to this database. Please contact your system administrator.", vbCritical, "Restricted Access!"
CloseDatabase
End If
End Sub
I want it where no one can accidently access the tables mainly, or modules, but I am able to get to the options section still so I dont know how to hide that as well. Thank you for any help