list separator or )

M

Mr.Kane

I am creating a login form and keep running into the same compile
error:

here is the code

Private Sub LogIn_OK_Button_Click()

'Check to see if data is entered into the UserName combo box
If IsNull(Me.LogIn_ID) Or Me.LogIn_ID = "" Then
MsgBox "You must enter a User Name.", vbOKOnly, "Required Data"
Me.LogIn_ID.SetFocus
Exit Sub
End If

'Check to see if data is entered into the password box
If IsNull(Me.Login_PW) Or Me.Login_PW = "" Then
MsgBox "You must enter a Password.", vbOKOnly, "Required Data"
Me.Login_PW.SetFocus
Exit Sub
End If

'Check value of password in Staff to see if this matches value chosen
in combo box
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& "")Then
Staff_Name = Me.LogIn_ID.Value


'Close logon form and open splash screen
DoCmd.Close acForm, "frmFOCUS-PRO Login Screen", acSaveNo
DoCmd.OpenForm "frmFOCUS-PRO (Front End)"
Else
MsgBox "Password Invalid. Please Try Again", vbOKOnly, "Invalid Entry!"
Me.Login_PW.SetFocus
End If


The error that is rendered is "Expected: List separator or )"

The highlighted portion of code is the double quotes after
&Me.Login_ID&

Any help would be appreciated

Marc Kane
 
S

Stefan Hoffmann

hi Marc,

Mr.Kane said:
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& "")Then
Staff_Name = Me.LogIn_ID.Value
The error that is rendered is "Expected: List separator or )"
There is the closing ' in the condition missing:

DLookup("Staff_Password", _
"Staff", _
"[Staff_ID]='" & Me.LogIn_ID & "'")


mfG
--> stefan <--
 
M

Mr.Kane

Stefan,

Thanks for the quick reply

I made the change but I'm still encountering the same error
here is the new code:
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& ""')Then
Staff_Name = Me.LogIn_ID.Value

The highlighted segment of code are the 2 double quotes after
&Me.LogIn_ID&

I'm sure the correct syntax will be obvious after the fact but it's
incredibly frustrating right now.

Thanks again
Marc

Stefan said:
hi Marc,

Mr.Kane said:
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& "")Then
Staff_Name = Me.LogIn_ID.Value
The error that is rendered is "Expected: List separator or )"
There is the closing ' in the condition missing:

DLookup("Staff_Password", _
"Staff", _
"[Staff_ID]='" & Me.LogIn_ID & "'")


mfG
--> stefan <--
 
S

Stefan Hoffmann

hi,

Mr.Kane said:
I made the change but I'm still encountering the same error
here is the new code:
It's a copy error, be careful with the order of " (double quote) and '
(single quote).
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& ""')Then
Must be
& "'") Then
There is the closing ' in the condition missing:

DLookup("Staff_Password", _
"Staff", _
"[Staff_ID]='" & Me.LogIn_ID & "'")


mfG
--> stefan <--
 
M

Mr.Kane

Stefan,

Can I send you a screenshot of the error for your evaluation. I believe
that I have he oprder correct but it may help you to see the error and
the highlighted code segment. Can I send you a Microsoft Word doc with
the screenshots privately?


Thanks
Marc Kane


Stefan said:
hi,

Mr.Kane said:
I made the change but I'm still encountering the same error
here is the new code:
It's a copy error, be careful with the order of " (double quote) and '
(single quote).
If Me.Login_PW = DLookup("Staff_Password", "Staff", "[Staff_ID]='"
&Me.LogIn_ID& ""')Then
Must be
& "'") Then
There is the closing ' in the condition missing:

DLookup("Staff_Password", _
"Staff", _
"[Staff_ID]='" & Me.LogIn_ID & "'")


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top