Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update, Append & Delete. Is there a better way?

Status
Not open for further replies.

LouiseJ

Technical User
May 18, 2005
29
GB
I am trying to automatically populate a nested form with records each time the parent form has a new record.

The nested forms record source is TblPrintColour.

The only way that I have been able to do this up till now is to create a duplicate table (TblPrintColour2) and use an update query to create the records in this table. The records then have to be appended to TblPrintColour with an append query and finally deleted from TblPrintColour2 with a delete query.

Is there a better way? It seems a bit overkill to be creating a table to hold temporary records.

Queries as follows.

UPDATE TblPositive LEFT JOIN TblPrintColour2 ON TblPositive.PositiveID1 = TblPrintColour2.PositiveID3 SET TblPrintColour2.Line2ID3 = Forms!FrmSOP!FrmSubOrderLine1!FrmSubOrderLine1Line2!Line2ID, TblPrintColour2.PositiveID3 = [PositiveID1], TblPrintColour2.ColourID3 = [ColourID2]
WHERE (((TblPositive.DesignID2)=[Forms]![FrmSOP]![FrmSubOrderLine1]![DesignID2]));

INSERT INTO TblPrintColour ( PositiveID3, ColourID3, Line2ID3 )
SELECT TblPrintColour2.PositiveID3, TblPrintColour2.ColourID3, TblPrintColour2.Line2ID3
FROM TblPrintColour2;

DELETE TblPrintColour2.PositiveID3, TblPrintColour2.ColourID3, TblPrintColour2.Line2ID3
FROM TblPrintColour2;

Thanks

LouiseJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top