Access Switchboard Form Allow access

gaccess

Registered User.
Local time
Today, 19:49
Joined
Apr 17, 2011
Messages
32
I have a switch board to allow login for a few users plus admin user - screenshot attached.
I had the admin log in working or so I thought (well I was pleased with my first bit of VBA that worked then oh dissapointment when I found that no entry or blank would allow the main form to open
my original code

Private Sub btn_adminlogin_Click()
Dim strWhere As String
If txt_admin_pass <> "password" Then
MsgBox "Incorrect Password"
Else
DoCmd.OpenForm "Incident Form" ' ac Normal
End If
End Sub
then I tried something else but I've been playing with this for far too long now
Private Sub btn_adminlogin_Click()
If Me.txt_admin_pass Is Null Then
MsgBox "Please Enter Password"
Me.txt_admin_pass.SetFocus
Else
If txt_admin_pass <> "password" Then
MsgBox "Incorrect Password"
Else
DoCmd.OpenForm "Incident Form" ' ac Normal
End If
End Sub

As for the top row (of screenshot), (I have a table tbl_depot which has field [depot] source for the combo box and [passcode]) the unbound box txt_dpt_pass I was hoping to open via a query only those matching the depot but I,m stumped on both:(
 

Attachments

  • inc_login.png
    inc_login.png
    51.8 KB · Views: 109
Last edited:
Try...

Private Sub btn_adminlogin_Click()

If txt_admin_pass = "password" Then
DoCmd.OpenForm "Incident Form" ' ac Normal
Else
MsgBox "Incorrect Password, try again!"
Me.txt_admin_pass = ""
Me.txt_admin_pass.SetFocus
End If

End Sub

Of course, the above suggest only the Admin can log in.
 
yes that works (why didn't I think of that)(yeh right) oh well it's all a good learning curve especially when I start to see why my try didn't and why yours did :)
 

Users who are viewing this thread

Back
Top Bottom