Solved

SQL INSERT error - Excel VBA/ADO/Access 2016

Posted on 2016-11-15
2
79 Views
Last Modified: 2016-11-15
I'm getting a strange error.
When I send this INSERT statement from Excel I get an error 'Syntax error in INSERT INTO statement'.

INSERT INTO tblRegularAttendance(ApplicationID, DayNumber, DayName, Session, RoleTitle, Hospital) VALUES('1234567',  4, 'Thursday', '4AM', 'Driver', 'Guys')

Open in new window

But when I run that in the Query Window in Access it runs ok!

The Connection is the same as I use for other ADO INSERT operations on this application.

Any ideas please?
Thanks
0
Comment
Question by:hindersaliva
2 Comments
 
LVL 51

Expert Comment

by:Ryan Chong
ID: 41887814
what error you getting here? make sure you insert the values with same data types?
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 41887911
Perhaps Session is a reserved name, and spaces as shown:

INSERT INTO tblRegularAttendance (ApplicationID, DayNumber, DayName, [Session], RoleTitle, Hospital) 
VALUES ('1234567',  4, 'Thursday', '4AM', 'Driver', 'Guys')

Open in new window

/gustav
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question