Microsoft Access IIF Function (IF/Then)

how to make user login form in microsoft access

fiusername.SetFocus
If username = "staff1" And password = "staff1" Then
MsgBox "Successfully Loged", vbInformation, "HSGP Telephone Directory"
MsgBox "Welcome", vbInformation, "HSGP-Dodsal Site"
DoCmd.Close
DoCmd.OpenForm "Form1"
ElseIf username = "manager1" And password = "manager1" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"


ElseIf username = "manager2" And password = "manager2" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"

ElseIf username = "manager3" And password = "manager3" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"



ElseIf username = "manager4" And password = "manager4" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"



ElseIf username = "manager5" And password = "manager5" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"


ElseIf username = "manager5" And password = "manager5" Then
MsgBox "Successfully Loged", vbInformation, "Admin Area"
DoCmd.Close
DoCmd.OpenForm "form1"






Else
MsgBox "please Re-enter your User Name and Pasword"
End If

 

Featured