Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

SQL INSERT error - Excel VBA/ADO/Access 2016

Posted on 2016-11-15
2
Medium Priority
?
163 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 53

Expert Comment

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

Accepted Solution

by:
Gustav Brock earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
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…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

610 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