RuralGuy said:In conjunction with disabling the shift key in the BackEnd, I launch a small form that tells the user Table Access is only available using the FrontEnd and then quits Access.
RuralGuy said:The toolbars never even show up, just the MsgBox with OK only. Press ok and the app closes.
RuralGuy said:Here's two mdb's. One locked and one open. Have fun.
This is in the BackEnd *only* to keep users from inadvertantly opening the wrong db. The FrontEnd can easily be locked down with similar means so the user *must* use your forms to run the db.re-opens the database and hes straight into the backend
Option Compare Database
Private intLogonAttempts As Integer
Private Sub Form_Open(Cancel As Integer)
'On open set focus to combo box
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 "Skriv inn brukernavn.", vbOKOnly, "Obligatorisk felt"
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 "Skriv inn passord.", vbOKOnly, "Obligatorisk felt"
Me.txtPassword.SetFocus
Exit Sub
End If
'Check value of password in tblEmployees to see if this matches value chosen in combo box
If Me.txtPassword.Value = DLookup("strEmpPassword", "tblEmployees", "[lngEmpID]=" & Me.cboEmployee.Value) Then
lngMyEmpID = Me.cboEmployee.Value
'Close logon form and open splash screen
DoCmd.Close acForm, "frmLogon", acSaveNo
DoCmd.OpenForm "sentralbord"
Else
MsgBox "Feil passord", vbOKOnly, "Ugyldig data!"
Me.txtPassword.SetFocus
End If
'If User Enters incorrect password 3 times database will shutdown
intLogonAttempts = intLogonAttempts + 1
If intLogonAttempts > 2 Then
MsgBox "Du har tastet feil passord tre ganger. Vennligst kontakt administrator.", vbCritical, "Begrenset tilgang!"
Application.Quit
End If
End Sub
Teebird said:ghudson Hi
Just a question - Do I name the module just "Public" and where do I put the bDisableBypassKey command button - I have a user logon form the loads first and then a switchboard or do I create a new form and put the button there?
Tee
Not if your database is properly secured. You can also password protect the moduleswmburgess said:I would like to say that ghudson's code works.
The only problem I see is that a user can hit Ctrl/Break and view code and password.
This solution is good enough for my problems.
Thanks.
. I do both.
In my original response to this thread I did state... "Assign this to the OnClick event of a command (transparent?) button named "bDisableBypassKey".teiben said:Somewhere the code should state that you have to have a switchboard, the form opens to switchboard on startup