Update Query Help

R

RCL

The following query runs without error, but does not update the fields. I
have a similar query that works fine. Any help is appreciated.

UPDATE SummryT002, SummryT003_RptData
SET SummryT002.RptName = SummryT003_RptData!RptName,
SummryT002.RptBegDt = SummryT003_RptData!RptBegDt,
SummryT002.RptEnd = SummryT003_RptData!RptEnd
WHERE (((SummryT002.IDToUse)=[SummryT003_RptData].[IDToUse]));
 
J

John Vinson

The following query runs without error, but does not update the fields. I
have a similar query that works fine. Any help is appreciated.

UPDATE SummryT002, SummryT003_RptData
SET SummryT002.RptName = SummryT003_RptData!RptName,
SummryT002.RptBegDt = SummryT003_RptData!RptBegDt,
SummryT002.RptEnd = SummryT003_RptData!RptEnd
WHERE (((SummryT002.IDToUse)=[SummryT003_RptData].[IDToUse]));

Use a JOIN clause rather than joining in the WHERE clause, and a
period rather than an exclamation point to delimit fieldnames:

UPDATE SummryT002 INNER JOIN SummryT003_RptData
ON SummryT002.IDToUse=[SummryT003_RptData].[IDToUse]
SET SummryT002.RptName = SummryT003_RptData.RptName,
SummryT002.RptBegDt = SummryT003_RptData.RptBegDt,
SummryT002.RptEnd = SummryT003_RptData.RptEnd;


John W. Vinson[MVP]
 
J

John Spencer (MVP)

In addition to John's response, may I ask how you are running the query?

If you are simply switching to the table grid, then you are not executing the
query. Try clicking on the RUN button (a red exclamation mark) or selecting RUN
from the menubar.

John said:
The following query runs without error, but does not update the fields. I
have a similar query that works fine. Any help is appreciated.

UPDATE SummryT002, SummryT003_RptData
SET SummryT002.RptName = SummryT003_RptData!RptName,
SummryT002.RptBegDt = SummryT003_RptData!RptBegDt,
SummryT002.RptEnd = SummryT003_RptData!RptEnd
WHERE (((SummryT002.IDToUse)=[SummryT003_RptData].[IDToUse]));

Use a JOIN clause rather than joining in the WHERE clause, and a
period rather than an exclamation point to delimit fieldnames:

UPDATE SummryT002 INNER JOIN SummryT003_RptData
ON SummryT002.IDToUse=[SummryT003_RptData].[IDToUse]
SET SummryT002.RptName = SummryT003_RptData.RptName,
SummryT002.RptBegDt = SummryT003_RptData.RptBegDt,
SummryT002.RptEnd = SummryT003_RptData.RptEnd;

John W. Vinson[MVP]
 
Top