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

Anonymous
2012-01-28T22:28:54+00:00

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

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
{count} votes
Answer accepted by question author
  1. Anonymous
    2012-01-30T15:57:28+00:00

    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 & "'"

    1. 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.

    8 people found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2012-01-30T15:38:24+00:00

    Hi Rebecca,

    What are you doing when you receive this error message?  Are you actually using Access or are you writing code from another application that is trying to read data from an Access database?  If you are writing code from another application, then you will need to find a forum that supports the language you are writing your code in.  If you are receiving this error within Access, what exactly are you doing within Access?

    Best Regards,

    Nathan O.

    Microsoft Online Community Support

    0 comments No comments