Combine 2 If Statements

burrina

Registered User.
Local time
Today, 08:22
Joined
May 10, 2014
Messages
972
I get stumped on the simplest of things?
'Check To See If Users Computer Name matches Auto login Criteria.
'rememberme field size is integer & default value is 1 Or -1
2nd If is the issue!
In plain English, if the pc being used matches the stored pcID and if user has chosen to autologin then open frmMainMenu else open frmLogin
I already have code above this that exits the code if the pc is not the users pc.

If DLookup("[pcID]", "tblUserSecurityAutoLogin") <> (Me.txtComputerName1) Then
If DLookup("[rememberme]", "tblUserSecurityAutoLogin") = 1 Then 'True

DoCmd.OpenForm "frmMainMenu"
DoCmd.Close acForm, "frmAutoLogin"
ElseIf DLookup("[rememberme]", "tblUserSecurityAutoLogin") = -1 Then 'False
DoCmd.OpenForm "frmLogin"
DoCmd.Close acForm, "frmAutoLogin"
End If
End If
 
Perhaps something like:
Code:
If DLookup("[pcID]", "tblUserSecurityAutoLogin") =(Me.txtComputerName1) AND DLookup("[rememberme]", "tblUserSecurityAutoLogin") = 1 Then 'True

  DoCmd.OpenForm "frmMainMenu"
  DoCmd.Close acForm, "frmAutoLogin"
ElseIf DLookup("[rememberme]", "tblUserSecurityAutoLogin") = -1 Then 'False
  DoCmd.OpenForm "frmLogin"
  DoCmd.Close acForm, "frmAutoLogin"

End If
 
Thanks so much. That did the trick! My senior moments are coming way too often.At my age, guess I'm allowed one or two ever now and again.
 
Thanks so much. That did the trick! My senior moments are coming way too often.At my age, guess I'm allowed one or two ever now and again.
I know that feeling, only too well.:D
 

Users who are viewing this thread

Back
Top Bottom