Have I Stumbled Across a Reserved Word?

gray

Registered User.
Local time
Today, 23:16
Joined
Mar 19, 2007
Messages
578
Hi All

Access2002/2007
WinXPPro Sp2

Anyone know if 'Work' a reserved word or similar?

I'm building some SQL in VB which copies records within the same tables. The SQL is actionned as part of a BeginTrans, CommitTrans procedure. This procedure sits within a Publc standalone module and so can be called from various forms. It uses SELECT INSERT to perform the actual copy.

All works fine except for one particular table; with that table I get an Invalid Syntax error for the INSERT statement.

It's taken me some time but by elimination I've discovered that it fails when the column 'Work' is included in the SELECT INSERT statement ('Work' and 'Home' are settings for contact addresses).

I thought it might have been a corruption so I've recreated the column and the Table but it always fails when the 'Work' column is included. 'Work', incidentally, is a Yes/No field so it's not a textual (e.g. apostrophe) problem.

I printed the SQL generated by my VB and ran it in the Query builder and, hey presto, it works perfectly! It only fails when run in the Module?

Is 'Work' a reserved word? I dread having to rename this (and corresponding columns) as it is used all over the place!

Any ideas anyone?... my SQL below... thanks

Code:
INSERT INTO Addrs_To_Cntcts (
Addrs_Unique_No,
Date_Record_Added,Added_By_Unique_No,
Locked,
Name,
Description,
Type,
Home,
Work) 
SELECT 
397,
'17/02/2011 10:49:07',
7,
True,
Name,
Description,
Type,
Home,
Work 
FROM Addrs_To_Cntcts WHERE Unique_No = 309
 
Locked, Name, Type, True are all reserved words
 
Yes Work is a reserved word when used with ODBC, according to access help

JR
 
Curses!.... I started this in Access2002 and I don't recall getting the warnings which I've just found when re-declaring it in Access 2007...

Drawing Board and all that! .... thanks all!
 
or put [work], not pretty but should work *padam bam*
 

Users who are viewing this thread

Back
Top Bottom