Results 1 to 6 of 6

Thread: access error

  1. #1
    Join Date
    May 2012
    Posts
    2

    Unanswered: access error

    I have 3 columns in a table in Microsoft Access. One of the columns is entitled MIL-STD-2525BCode. I have a complicated sql query that is not working but if I narrow it down to

    select MIL-STD-2525BCode from my_table

    it gives me back the error "Syntax error (missing operator) in query expression 'MIL-STD-2525BCode'.

    Got any ideas why? all my other columns work fine but this one doesn't.

    thanks!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    are we allowed to see the query?
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    May 2012
    Posts
    2
    I'm trying to compare 2 tables to see if there is any difference. The query is kind of long but, it comes down to this issue

    select MIL-STD-2525BCode from JMPSSymbolCodes

    not working. I have tried

    select "MIL-STD-2525BCode" from JMPSSymbolCodes
    and
    select 'MIL-STD-2525BCode' from JMPSSymbolCodes

    and they don't give me what I want. MIL-STD-2525BCode is a column of strings.

    thanks!

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    and are we allowed to see the query?
    the description is all fine and dandy, but it doesn't show where the error is
    it doesn't give us any chance of seeing where the problem may lie
    at present I'm a little suspicious of a column called
    MIL-STD-2525BCode

    looking at Access 2007 reserved words and symbols - Access - Office.com suggests you may have a problem with the column name. remove the hyphens and see if that clears the fault
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try using:
    Code:
    select [MIL-STD-2525BCode] from my_table
    Have a nice day!

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    removing the hyphens would be a smarter call in my books

    using the square brackets to delimit the column name merely cures the symptoms not fix the problem
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •