View Full Version : Asterisk Error Message
Halfthumb
21st May 2009, 02:33.43 PM
When creating a simple query an error message refering to an asterisk is received. Why does Access put a comma and an asterisk at the end of the Select statement? When the comma and asterisk is deleted the query runs.
Rick
21st May 2009, 03:17.15 PM
Have you tried deleting the comma and asterisk?
The asterisk is a shortcut for all columns.
I had queries I made in '97 that gave me fits when I upgraded to 2000 and later versions. It wasn't until I opened them up in SQL View that I noticed the asterisk was in the query.
Halfthumb
21st May 2009, 03:40.50 PM
In my message I noted that when I deleted the comma and asterisk the query ran.
Rick
21st May 2009, 04:03.45 PM
I missread that.
I thought I read that Access deleted it when it ran. :eek:
Halfthumb
21st May 2009, 04:26.47 PM
So--the question is WHY?
MikeDee
22nd May 2009, 02:40.23 PM
Look at any query in access in the SQL view and you will see that all queries in sql end with a semi colon ;
If you are copying a query from vba code, like the stuff I sent you, the Sql has to be in a string so the SQL statement begins and ends with quote characters " "
If you should happen to copy a sql sting beginning with the word Select and copy all the way to end and then paste it in the query view, you will have an extraneous " character at the end of the query.
If you run it access will give you an error message like "extraneous characters at the end of the sql statement" Just delete the " character and the query will run.
if you are cutting and pasting in the future, in order to avoid this message just make sure that you don't paste any characters after the semi colon at the end of the sql statement
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.