Append with Criteria

  • Thread starter Thread starter TinMan
  • Start date Start date
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 !
 
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 !
 
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 !
 
Back
Top