G
Guest
Hi experts
I have a query named qryUpdate@QueryObjects which has the following SQL
UPDATE [@QueryObjects] INNER JOIN [@QueryObjects] AS [@QueryObjects_1] ON
[@QueryObjects].OBJECT_ID = [@QueryObjects_1].SHORTCUT SET
[@QueryObjects_1].FILENAME = [@QueryObjects].[FILENAME]
WHERE ((([@QueryObjects].FILENAME)<>[@QueryObjects_1].[FILENAME]) AND
(([@QueryObjects_1].CATEGORY)=13));
I can run this query successfully with the vba code
DoCmd.OpenQuery "qryUpdate@QueryObjects"
However, I would like to get rid of the query qryUpdate@QueryObjects and
just use vba code to produce the same effect. I've tried using
DoCmd.RunSQL ("UPDATE [@QueryObjects] INNER JOIN [@QueryObjects] AS
[@QueryObjects_1] ON [@QueryObjects].OBJECT_ID = [@QueryObjects_1].SHORTCUT
SET [@QueryObjects_1].FILENAME = [@QueryObjects].[FILENAME] WHERE
((([@QueryObjects].FILENAME)<>[@QueryObjects_1].[FILENAME]) AND
(([@QueryObjects_1].CATEGORY)=13));")
but this is not working.
Any ideas why, as the sql code is the same?
I have a query named qryUpdate@QueryObjects which has the following SQL
UPDATE [@QueryObjects] INNER JOIN [@QueryObjects] AS [@QueryObjects_1] ON
[@QueryObjects].OBJECT_ID = [@QueryObjects_1].SHORTCUT SET
[@QueryObjects_1].FILENAME = [@QueryObjects].[FILENAME]
WHERE ((([@QueryObjects].FILENAME)<>[@QueryObjects_1].[FILENAME]) AND
(([@QueryObjects_1].CATEGORY)=13));
I can run this query successfully with the vba code
DoCmd.OpenQuery "qryUpdate@QueryObjects"
However, I would like to get rid of the query qryUpdate@QueryObjects and
just use vba code to produce the same effect. I've tried using
DoCmd.RunSQL ("UPDATE [@QueryObjects] INNER JOIN [@QueryObjects] AS
[@QueryObjects_1] ON [@QueryObjects].OBJECT_ID = [@QueryObjects_1].SHORTCUT
SET [@QueryObjects_1].FILENAME = [@QueryObjects].[FILENAME] WHERE
((([@QueryObjects].FILENAME)<>[@QueryObjects_1].[FILENAME]) AND
(([@QueryObjects_1].CATEGORY)=13));")
but this is not working.
Any ideas why, as the sql code is the same?