Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Insert syntax error but works in Query

Status
Not open for further replies.

gazolba

Programmer
Dec 4, 2001
167
US
INSERT INTO tblTicketPriorityHist (TicketID, Priority, When, User) VALUES( 2, '2', #4/22/2004 8:30:15 AM#, 'dcmcspar')

The above statement causes a syntax error when executing VBA but when I paste into a query it runs.
I'm using ADO cn.execute statement to run the SQL.

Anyone got a clue?
 
It runs from the query design window or it runs when you save it as a query and then run it? There's a difference because action queries run from the design window are converted to Selects to show you the records that will be inserted ... it doesn't actually insert them.

A possible problem is that "User" is an Access keyword. Use [User] instead.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top