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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA/SQL Code Worked With Access But Not Now With SQL Server 1

Status
Not open for further replies.

DomDom3

Programmer
Jan 11, 2006
59
GB
Hi there,

I used the following code which worked well when my database was Access based, I've moved it to an SQL Server backend and I get an "incorrect syntax error".

DoCmd.RunSQL "INSERT INTO [tblUniqueKey] ([Unique ID Ref]) values [Unique Ref ID]"

The problem seems to be the [Unique Ref ID] at the end. I've tried moving this outside of the speech marks etc. but still no joy.

Can anyone help please?
 
which worked well
Really ? Even with the posted syntax error ?
I'd try this:
DoCmd.RunSQL "INSERT INTO [tblUniqueKey] ([Unique ID Ref]) VALUES (" & Me![Unique Ref ID] & ")"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top