422,363 Members | 2,348 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 422,363 IT Pros & Developers. It's quick & easy.

What is wrong with this statement

P: 2
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
Expand|Select|Wrap|Line Numbers
  1. SELECT  [ShipmentDetails-SelectPO].[Date Shipped] & "   " & [ShipmentDetails-SelectPO].POID, AS Expr1, [ShipmentDetails-SelectPO].[PO] FROM [ShipmentDetails-SelectPO] ORDER BY [ShipmentDetails-SelectPO].[PO];
1 Week Ago #1
Share this Question
Share on Google+
5 Replies


jns42
P: 3
You have an unnecessary ',' character before the "AS Expr1" statement.
1 Week Ago #2

P: 2
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.......
1 Week Ago #3

jns42
P: 3
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:

Expand|Select|Wrap|Line Numbers
  1. 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.
1 Week Ago #4

twinnyfo
Expert Mod 100+
P: 2,199
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.
1 Week Ago #5

NeoPa
Expert Mod 15k+
P: 30,631
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.
1 Week Ago #6

Post your reply

Sign in to post your reply or Sign up for a free account.