What is wrong with this statement

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • stacy08
    New Member
    • Apr 2018
    • 2

    What is wrong with this statement

    Very inexperienced in Access, trying to make a change to the order data pulls on a form. Made a change and now I am getting an error. What is wrong with this? TIA
    Code:
    SELECT  [ShipmentDetails-SelectPO].[Date Shipped] & "   " & [ShipmentDetails-SelectPO].POID, AS Expr1, [ShipmentDetails-SelectPO].[PO] FROM [ShipmentDetails-SelectPO] ORDER BY [ShipmentDetails-SelectPO].[PO];
    Last edited by twinnyfo; Apr 13 '18, 06:54 PM.
  • jns42
    New Member
    • Apr 2018
    • 3

    #2
    You have an unnecessary ',' character before the "AS Expr1" statement.
    Last edited by jns42; Apr 13 '18, 03:17 PM. Reason: Changed "extra" to "unnecessary"

    Comment

    • stacy08
      New Member
      • Apr 2018
      • 2

      #3
      jns42 Thank you! I removed that character and now I am getting a different error: This expression is typed incorrectly or is too complex to be evaluated...... .

      Comment

      • jns42
        New Member
        • Apr 2018
        • 3

        #4
        I'm not actually an Access expert, but in general T-SQL terms...

        It looks like you've also listed the source table twice - once before and once after the "FROM" clause. Try:

        Code:
        SELECT [ShipmentDetails-SelectPO].[Date Shipped] & " " & [ShipmentDetails-SelectPO].POID AS Expr1 FROM [ShipmentDetails-SelectPO] ORDER BY [ShipmentDetails-SelectPO].[PO]
        I've also removed the ending ';' character - Not sure if Access requires them.
        Last edited by twinnyfo; Apr 13 '18, 06:55 PM.

        Comment

        • twinnyfo
          Recognized Expert Moderator Specialist
          • Nov 2011
          • 3664

          #5
          stacy08,

          Welcome to Bytes!

          I'd be glad to help with this. However, in your second post, you do not tell us the error you are receiving. The type of error you receive helps us guide our response.

          Also, the final ";" is standard SQL syntax, and always a good idea to include.

          Thanks for the clarification.
          Last edited by twinnyfo; Apr 13 '18, 06:55 PM.

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32662

            #6
            Hi Stacy.

            Following on from the good advice you've already received, it helps to format your SQL in such a way as to be easily readable, and it helps to repost it after changes have been made. We can only assume you've followed the guidance accurately, and often that isn't the case.

            Here are some other tips for debugging SQL strings (How to Debug SQL String).

            PS. Welcome to Bytes.com for both Stacy08 AND jns42.

            PPS. The semi-colon (;) is perfectly acceptable when dealing with Jet/ACE SQL in Access. It isn't necessary though. Access will assume one if not there and multiple SQL statements are not acceptable in Jet/ACE SQL anyway, so it's not as important as in other environments.
            Last edited by NeoPa; Apr 14 '18, 02:40 AM.

            Comment

            Working...