473,411 Members | 1,982 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

Syntax error (comma) in query expression

6
It would be great if someone helps me out!

I'm getting an error as "Syntax error (comma) in query expression" for the below code in MS ACCESS 2007.

CurrentDb.Execute "INSERT INTO empmast(empno,empname,scale) SELECT ([EMP NO ], [EMP NAME], [SCALE]) from TABLEA"

Thanks in advance
Jun 10 '18 #1
7 2937
Nauticalgent
100 64KB
Only thing I would suggest is removing the parentheses in your select statement. But then, I avoid SQL statements and use stored queries whenever possible.

Have you considered using an Append Query and let Access do the work? They are much more efficient and you can still use the .Execute method to run them.
Jun 10 '18 #2
NeoPa
32,556 Expert Mod 16PB
If it isn't the space after "[Emp No" and before the next "]" then you'll need to show us the actual SQL used (See How to Debug SQL String).
Jun 10 '18 #3
NeoPa
32,556 Expert Mod 16PB
NauticalGent:
Have you considered using an Append Query and let Access do the work? They are much more efficient and you can still use the .Execute method to run them.
As the code shown is exactly that - an example of an Append Query - I'm not sure that's really a supportable comment.

That said, the extra parentheses may well be the issue. Good spot.
Jun 10 '18 #4
Nauticalgent
100 64KB
Agreed, they are one and the same. I am going on the premise that Access establishes a query plan for stored queries and does not have to take the time to convert the SQL statement.

I can imagine the overhead is negligible, but that is what I based my statement on...that and the fact I am lazy and prefer Access to do the heavy lifting for me!
Jun 10 '18 #5
NeoPa
32,556 Expert Mod 16PB
I see. You're using the term "Query" for the Access object that's a QueryDef. Fair enough, but I didn't realise that (SQL strings are also generally known as Queries).

As you say, the delay would be negligible. Hard even to quantify.
Jun 11 '18 #6
Nauticalgent
100 64KB
Curious as to how the OP is getting along with sorting this out..
Jun 11 '18 #7
NeoPa
32,556 Expert Mod 16PB
Often the way. Unfortunately we have no control over members' manners, or even their lives. There may be various good reasons why they haven't replied as yet. Certainly, an approach whereby you deal with what's in front of you only, is recommended. If you watch the kettle you'll only let yourself in for frustration.
Jun 11 '18 #8

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

Similar topics

1
by: Raphael Gluck | last post by:
Hi everyone I have a page on my site in which i wish to display links to brochures, and i have stored an index of these links in my database. however when i pass from the master page,...
1
by: Rolan | last post by:
I created a function module base on a query to provide a group record total for a subform and which is posted to a field on the main form. Everything seems to work fine except that I consistently...
8
by: Dalan | last post by:
Please help - just take a quick look at the function code below. It probably just needs some minor tweaking. The function module is based on an intermediate query to provide a group record...
1
by: maneeshkhare | last post by:
I am trying to update a field in Access db (.mdb) via a DataSet using the following code. I am continously getting this error: Has anybody seen this before? 1. If I try using the same code for...
1
by: amitbadgi | last post by:
I am geting the following error while conv an asp to asp.net Exception Details: System.Runtime.InteropServices.COMException: Syntax error in query expression 'id =System.__ComObject'. Source...
2
by: Tom Baxter | last post by:
I have a numeric column in a query called Prov1.Volume. When I try taking the sum of that column (using SUM aggregate function in Design View) it gives a syntax error. It says that...
4
by: veer | last post by:
Hi i am running a date query squery = "Insert into " & txttablename & " IN '" & txtdatabase & " ' select * from " & sTableName & " IN '" & txtfolderpath & "\" & sArrFolder(icount) & "\" &...
5
by: OzNet | last post by:
Can someone tell me what I am doing wrong here please? I have a form with two unbound text boxes formatted to short date and an OK button. My button code is as follows: Private Sub...
6
by: D Rid | last post by:
here is my SQL statement: SELECT . , .* , .* FROM ( INNER JOIN ON . = CDBL(])) INNER JOIN
1
by: Vasago | last post by:
I have narrowed it down to .Driver) =" & Me!. My employees do have a comma in their names. Thank you for your help. Error Code says: Run-time error '3075' Syntax error(comma) in query...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.