garywood84
Registered User.
- Local time
- Today, 21:49
- Joined
- Apr 12, 2006
- Messages
- 168
I am trying to make an append query to select records from one table based on certain criteria, and then insert the results into another table. I first created a select query to get the required data and then conveted this into an append query. However, when it runs, I get the following error:
"The INSERT INTO statement contains the following unknown field name: ‘ProgrammeID’. Make sure you have typed the name correctly, and try the operation again."
The SQL of the query is:
Please help - it's driving me insane!
Gary
"The INSERT INTO statement contains the following unknown field name: ‘ProgrammeID’. Make sure you have typed the name correctly, and try the operation again."
The SQL of the query is:
Code:
INSERT INTO tblMaterialsSalesOrders ( EventID, MaterialQuantity, MaterialID )
SELECT [Forms]![frmOrderMaterials]![EventID] AS EventID, IIf([tblMaterials].[MaterialStandardQuantityPer]="Class",[tblMaterials].[MaterialStandardQuantity]*[Forms]![frmOrderMaterials]![NumberOfClasses],IIf([tblMaterials].[MaterialStandardQuantityPer]="Group",[tblMaterials].[MaterialStandardQuantity]*[Forms]![frmOrderMaterials]![NumberOfGroups],IIf([tblMaterials].[MaterialStandardQuantityPer]="Student",[tblMaterials].[MaterialStandardQuantity]*[Forms]![frmOrderMaterials]![NumberOfStudents],IIf([tblMaterials].[MaterialStandardQuantityPer]="Teacher",[tblMaterials].[MaterialStandardQuantity]*[Forms]![frmOrderMaterials]![NumberOfTeachers],IIf([tblMaterials].[MaterialStandardQuantityPer]="Volunteer",[tblMaterials].[MaterialStandardQuantity]*[Forms]![frmOrderMaterials]![NumberOfVolunteers],0))))) AS MaterialQuantity, tblMaterials.MaterialID, *
FROM tblMaterials
WHERE (((tblMaterials.ProgrammeID)=[Forms]![frmOrderMaterials]![ProgrammeID]));
Please help - it's driving me insane!
Gary