G
Guest
I ran the sentence below using query in MS Access. The execution is working
well, has no any problem.
INSERT INTO Table1 ( [Deposit Number], Items, Amount, [Deposit Date],
Reported,
[Deposit Completed] )
SELECT Table2.i_itm_seq, Table2.item_count, Table2.a_dol, Table2.d_as_of,
Table2.F8, Table2.ScanCompleted
FROM Table2;
But, I changed the above sentence to VBA in MS Access, it has run-time error
# 3122
sqlCmd = "INSERT INTO [RE7 Deposits] ( [Deposit Number], " _
& "Items, Amount, [Deposit Date], Reported, [Deposit
Completed] ) " _
& "SELECT tbLockbox.i_itm_seq, Sum(tbLockbox.item_count) AS
SumOfitem_count, " _
& "Sum(tbLockbox.a_dol) AS SumOfa_dol, " _
& "tbLockbox.d_as_of, tbLockbox.F8, tbLockbox.ScanCompleted
FROM tbLockbox;"
DoCmd.RunSQL sqlCmd
How could I deal with this problem?
Thanks,
well, has no any problem.
INSERT INTO Table1 ( [Deposit Number], Items, Amount, [Deposit Date],
Reported,
[Deposit Completed] )
SELECT Table2.i_itm_seq, Table2.item_count, Table2.a_dol, Table2.d_as_of,
Table2.F8, Table2.ScanCompleted
FROM Table2;
But, I changed the above sentence to VBA in MS Access, it has run-time error
# 3122
sqlCmd = "INSERT INTO [RE7 Deposits] ( [Deposit Number], " _
& "Items, Amount, [Deposit Date], Reported, [Deposit
Completed] ) " _
& "SELECT tbLockbox.i_itm_seq, Sum(tbLockbox.item_count) AS
SumOfitem_count, " _
& "Sum(tbLockbox.a_dol) AS SumOfa_dol, " _
& "tbLockbox.d_as_of, tbLockbox.F8, tbLockbox.ScanCompleted
FROM tbLockbox;"
DoCmd.RunSQL sqlCmd
How could I deal with this problem?
Thanks,