I am trying to append records from a form to two different tables. I have the code working to append into one table but I get an error message when I run this code to append data to a different (linked) table
INSERT INTO TRAN (VEN_ID, CARRIER, CTRL_NUM, PALLET_TYP, CTRL_ID, CTRL_DT, TRAILER_ID, TRAN_DT, IN_OK, OUT_OK ) SELECT 'CHEP' as VEN_ID, [Forms]![frmChepRtn]![Carrier] as CARRIER, [Forms]![frmChepRtn]![CTRL_NUM] as CTRL_NUM, 'CHEP' as PALLET_TYP, ((DMax('CTRL_ID', 'TRAN',))+1) as CTRL_ ID, [Forms]![frmChepRtn]![ReturnDate] as CTRL_DT, [Forms]![frmChepRtn]![Trailer] as TRAILER_ID, [Forms]![frmChepRtn]![ReturnDate] as TRAN_DT, '0' as IN_OK, [Forms]![frmChepRtn]![ReturnQty] as OUT_OK
the error message says the number of query values is not the same as the number of destination fields. I matched value for value and nothing is left over, so I am missing something (probably obvious).
Can anyone enlighten me?
Thanks,
Bruce
INSERT INTO TRAN (VEN_ID, CARRIER, CTRL_NUM, PALLET_TYP, CTRL_ID, CTRL_DT, TRAILER_ID, TRAN_DT, IN_OK, OUT_OK ) SELECT 'CHEP' as VEN_ID, [Forms]![frmChepRtn]![Carrier] as CARRIER, [Forms]![frmChepRtn]![CTRL_NUM] as CTRL_NUM, 'CHEP' as PALLET_TYP, ((DMax('CTRL_ID', 'TRAN',))+1) as CTRL_ ID, [Forms]![frmChepRtn]![ReturnDate] as CTRL_DT, [Forms]![frmChepRtn]![Trailer] as TRAILER_ID, [Forms]![frmChepRtn]![ReturnDate] as TRAN_DT, '0' as IN_OK, [Forms]![frmChepRtn]![ReturnQty] as OUT_OK
the error message says the number of query values is not the same as the number of destination fields. I matched value for value and nothing is left over, so I am missing something (probably obvious).
Can anyone enlighten me?
Thanks,
Bruce