G
Guest
I'm trying compare multiple Or statements to match names with passwords.
The statement really needs to be:
If Forms!login1.login = "Davis" And Me![Password] = "dav" or
Forms!login1.login ...
but, this will wind up being too long and it will "word wrap", thus causing
errors.
High security isn't needed so I came up with this with help from these
boards
Is there a way to simplify the following:
-----------------------------------------------
Dim name As String
name = "Forms!login1.login"
If name = "Davis" And Me![Password] = "dav" Or name = "Neal" And
Me![Password] = "nea" Or name = "Reynolds" And Me![Password] = "rey" Or name
= "Lyons" And Me![Password] = "lyo" Or name = "Lauth" And Me![Password] =
"lau" Or name = "Bonds" And Me![Password] = "bon" Or name = "Eckhoff" And
Me![Password] = "eck" Or name = "Corrigan" And Me![Password] = "cor" Or name
= "Setterlund" And Me![Password] = "set" Or name = "Jimenez" And
Me![Password] = "jim" Or name = "Dehart" And Me![Password] = "deh" Or name =
"Cowsert" And Me![Password] = "cow" Or name = "McClellan" And Me![Password] =
"mcc" Or name = "Scott" And Me![Password] = "sco" Or name = "Bennett" And
Me![Password] = "ben" Or name = "Holzhauer" And Me![Password] = "hol" Or name
= "Merlino" And Me![Password] = "mer" Or name = "Harrington" And
Me![Password] = "har" Then
gOkToClose = True
Dim Employee As String
Employee = Forms!login1.[Login]
DoCmd.Close acForm, "Login1"
DoCmd.OpenForm "Timesheet", acNormal, "", "", acAdd, acNormal
Forms!timesheet.SetFocus
Forms!timesheet.Employee = Employee
The statement really needs to be:
If Forms!login1.login = "Davis" And Me![Password] = "dav" or
Forms!login1.login ...
but, this will wind up being too long and it will "word wrap", thus causing
errors.
High security isn't needed so I came up with this with help from these
boards

Is there a way to simplify the following:
-----------------------------------------------
Dim name As String
name = "Forms!login1.login"
If name = "Davis" And Me![Password] = "dav" Or name = "Neal" And
Me![Password] = "nea" Or name = "Reynolds" And Me![Password] = "rey" Or name
= "Lyons" And Me![Password] = "lyo" Or name = "Lauth" And Me![Password] =
"lau" Or name = "Bonds" And Me![Password] = "bon" Or name = "Eckhoff" And
Me![Password] = "eck" Or name = "Corrigan" And Me![Password] = "cor" Or name
= "Setterlund" And Me![Password] = "set" Or name = "Jimenez" And
Me![Password] = "jim" Or name = "Dehart" And Me![Password] = "deh" Or name =
"Cowsert" And Me![Password] = "cow" Or name = "McClellan" And Me![Password] =
"mcc" Or name = "Scott" And Me![Password] = "sco" Or name = "Bennett" And
Me![Password] = "ben" Or name = "Holzhauer" And Me![Password] = "hol" Or name
= "Merlino" And Me![Password] = "mer" Or name = "Harrington" And
Me![Password] = "har" Then
gOkToClose = True
Dim Employee As String
Employee = Forms!login1.[Login]
DoCmd.Close acForm, "Login1"
DoCmd.OpenForm "Timesheet", acNormal, "", "", acAdd, acNormal
Forms!timesheet.SetFocus
Forms!timesheet.Employee = Employee