Append with Criteria

T

TinMan

Hi Everyone, I have 2 sub tables that are foreign key related (Reg No). I
need to move data from one table (t1) to (t2), where both the Reg No and
weekending fields are equal. I have created an Append/Update qry and posted
the SQL as follows:

INSERT INTO [Vehicle Payments] ( StartODO, FinishODO, WeekEnding, WeekEnding )
SELECT [Weekly Mileage].StartODO, [Weekly Mileage].FinishODO, [Weekly
Mileage].WeekEnding, [Vehicle Payments].WeekEnding
FROM [Weekly Mileage], [Vehicle Payments]
WHERE ((([Weekly Mileage].WeekEnding)=[Weekly Payments].[Weekending]) AND
(([Vehicle Payments].Reg)=[Weekly Payments].[RegNo]));

Thank U All !
 
T

TinMan

TinMan said:
Hi Everyone, I have 2 sub tables that are foreign key related (Reg No). I
need to move data from one table (t1) to (t2), where both the Reg No and
weekending fields are equal. I have created an Append/Update qry and posted
the SQL as follows:

INSERT INTO [Vehicle Payments] ( StartODO, FinishODO, WeekEnding, WeekEnding )
SELECT [Weekly Mileage].StartODO, [Weekly Mileage].FinishODO, [Weekly
Mileage].WeekEnding, [Vehicle Payments].WeekEnding
FROM [Weekly Mileage], [Vehicle Payments]
WHERE ((([Weekly Mileage].WeekEnding)=[Weekly Payments].[Weekending]) AND
(([Vehicle Payments].Reg)=[Weekly Payments].[RegNo]));

When i run the qry it asks me for the date and reg but i would like the qry to just compare the reg and date are same and add the 2 fields i need putting in. Thank U All !
 
T

TinMan

TinMan said:
Hi Everyone, I have 2 sub tables that are foreign key related (Reg No). I
need to move data from one table (t1) to (t2), where both the Reg No and
weekending fields are equal. I have created an Append/Update qry and posted
the SQL as follows:

INSERT INTO [Vehicle Payments] ( StartODO, FinishODO, WeekEnding, WeekEnding )
SELECT [Weekly Mileage].StartODO, [Weekly Mileage].FinishODO, [Weekly
Mileage].WeekEnding, [Vehicle Payments].WeekEnding
FROM [Weekly Mileage], [Vehicle Payments]
WHERE ((([Weekly Mileage].WeekEnding)=[Weekly Payments].[Weekending]) AND
(([Vehicle Payments].Reg)=[Weekly Payments].[RegNo]));

Thank U All !
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top