[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 181
  • Last Modified:

SQL INSERT error - Excel VBA/ADO/Access 2016

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
hindersaliva
Asked:
hindersaliva
1 Solution
 
Ryan ChongCommented:
what error you getting here? make sure you insert the values with same data types?
0
 
Gustav BrockCIOCommented:
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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now