D
Douglas J. Steele
Your current SQL is actually invalid (your database name is outside of the
quotes), but if you want both tables to be in the external database, you
need IN statements for both of them.
ALLSQL = "INSERT INTO tblTransferDetails IN 'C:\RedAct.mdb' " & _
"( TDQuantity, TDItemID )" & _
"SELECT tblCheckDetailsTMP.CDQuantity, tblCheckDetailsTMP.CDItemID " & _
"FROM tblCheckDetailsTMP IN 'C:\RedAct.mdb' " & _
"WHERE
tblCheckDetailsTMP.CDCheckID=[Forms]![frmTransferItem]![TxtRightID];"
DoCmd.RunSQL (ALLSQL)
You could also use
ALLSQL = "INSERT INTO [;Database=C:\RedAct.mdb].tblTransferDetails " & _
"( TDQuantity, TDItemID )" & _
"SELECT tblCheckDetailsTMP.CDQuantity, tblCheckDetailsTMP.CDItemID " & _
"FROM [;Database=C:\RedAct.mdb].tblCheckDetailsTMP " & _
"WHERE
tblCheckDetailsTMP.CDCheckID=[Forms]![frmTransferItem]![TxtRightID];"
DoCmd.RunSQL (ALLSQL)
quotes), but if you want both tables to be in the external database, you
need IN statements for both of them.
ALLSQL = "INSERT INTO tblTransferDetails IN 'C:\RedAct.mdb' " & _
"( TDQuantity, TDItemID )" & _
"SELECT tblCheckDetailsTMP.CDQuantity, tblCheckDetailsTMP.CDItemID " & _
"FROM tblCheckDetailsTMP IN 'C:\RedAct.mdb' " & _
"WHERE
tblCheckDetailsTMP.CDCheckID=[Forms]![frmTransferItem]![TxtRightID];"
DoCmd.RunSQL (ALLSQL)
You could also use
ALLSQL = "INSERT INTO [;Database=C:\RedAct.mdb].tblTransferDetails " & _
"( TDQuantity, TDItemID )" & _
"SELECT tblCheckDetailsTMP.CDQuantity, tblCheckDetailsTMP.CDItemID " & _
"FROM [;Database=C:\RedAct.mdb].tblCheckDetailsTMP " & _
"WHERE
tblCheckDetailsTMP.CDCheckID=[Forms]![frmTransferItem]![TxtRightID];"
DoCmd.RunSQL (ALLSQL)