user Group

sandrao

Registered User.
Local time
Today, 15:38
Joined
Sep 6, 2007
Messages
34
I have a small db that I will be having three groups accessing it. I want to restrict each groups access to one or all forms. I would like to have a simple password form to do this. Can this "If" statement used for three different passwords and three different forms?
Private Sub Password_AfterUpdate()
If Me![Password] = "ssulano" Then
DoCmd.OpenForm "ModifyInvoice"
Else
MsgBox "Incorrect password", 16, "Password"
DoCmd.Close
End If
End Sub

Or is there another method of doing this?

sandrao
 
You could do:

If PASSWORD = "pass1" Then

DoCmd.OpenForm "Form1"

ElseIf PASSWORD = "pass2" Then

DoCmd.OpenForm "Form2"

ElseIf PASSWORD = "pass3" Then

DoCmd.OpenForm "Form2"

Else

msgbox "Incorrect Passsword", vbokonly
DoCmd.Close
End If
 
If you are going to hard code the passwords in then you can do that, but you could also use a table so you can have an easier time changing it if you needed to for any group.

To kind of simplify odin1701's example, you can do:
Code:
Dim strForm As String
Select Case Me.YourTextBoxNameHere

   Case "Group1Password"

      strForm = "YourGroup1Form"

   Case "Group2Password"

      strForm = "YourGroup2Form"

   Case "Group3Password"

      strForm = "YourGroup3Form"

End Select

   DoCmd.OpenForm strForm, acNormal
 

Users who are viewing this thread

Back
Top Bottom