Question

Q: 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

Answer

A:

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

Did this solve your problem?

Sorry this didn't help.

6 people were helped by this reply



 
Question Info

Views: 7,213 Last updated: April 17, 2018 Applies to: