Microsoft JET Database Engine error '80040e14' Syntax error (missing operator) in query expression 'UserID ='. /index.asp, line 51

Help! and please, in simple English. I am not a computer guru; neither am I a neophyte. However, my patience with computers is very limited and I am unfortunately, very dependent. I am working on my PhD dissertation, so time is at a premium.
Thanks to any and all who help and in step by step directions with terms I understand. Ta
rb
 

Question Info


Last updated July 10, 2018 Views 7,536 Applies to:
Answer
Help! and please, in simple English. I am not a computer guru; neither am I a neophyte. However, my patience with computers is very limited and I am unfortunately, very dependent. I am working on my PhD dissertation, so time is at a premium.
Thanks to any and all who help and in step by step directions with terms I understand. Ta
rb


Since the error appears to come from an ASP page, I assume you're using VBScript to query an Access database.  It would be very helpful to see the code lines that build the SQL string and then execute it or open a recordset on it.  Here are some things to check, though:

1. If the UserID value you are trying to concatenate into your SQL string as a criterion is a text value, make sure that you build quotes into the SQL string surrounding that value.  For example, if you have code like this:

    Dim strUserID
    Dim strSQL

    strUserID = "Fred"

    strSQL = "SELECT * FROM MyTable WHERE UserID = " & strUserID

... then you should change that last line to something like this:

     strSQL = "SELECT * FROM MyTable WHERE UserID = '" & strUserID & "'"

2. Make sure that whatever variable you are concatenating into the SQL string actually has a non-Null, non-blank value.  For debugging, add a line like

    Response.Write strSQL

to see what the SQL string actually looks like.  If you can't see what's wrong, post that here.

 

 

Dirk Goldgar, MS Access MVP 2001-2015
Access tips: www.datagnostics.com/tips.html

6 people were helped by this reply

·

Did this solve your problem?

Sorry this didn't help.

Great! Thanks for marking this as the answer.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this response?

Thanks for your feedback.