This is my test data (qry_Income_ByDate)
NQCG_Month Category Amount
Jan-19 Credit $70
Jan-19 Credit $20
Jan-19 Debit $245
Jan-19 Credit $60
I want to perform the following:
1. DSum the [Amount] according to the Category [Credit]
2. Save the results INTO a new table (tbl_TmpTrans_ByDate)
This is my code which will not work. Can anyone help please.
Set db = CurrentDb()
DoCmd.RunSQL "SELECT qry_Income_ByDate.[Category],DSum(qry_Income_ByDate.[Amount], "qry_Income_ByDate", "[Category] = 'Credit'")," & _
" qry_Income_ByDate.[NQCG_Month]" & _
" INTO tbl_TmpTrans_ByDate FROM qry_Income_ByDate" & _
" GROUP BY qry_Income_ByDate.[Category], qry_Income_ByDate.[NQCG_Month];
Set db = Nothing
NQCG_Month Category Amount
Jan-19 Credit $70
Jan-19 Credit $20
Jan-19 Debit $245
Jan-19 Credit $60
I want to perform the following:
1. DSum the [Amount] according to the Category [Credit]
2. Save the results INTO a new table (tbl_TmpTrans_ByDate)
This is my code which will not work. Can anyone help please.
Set db = CurrentDb()
DoCmd.RunSQL "SELECT qry_Income_ByDate.[Category],DSum(qry_Income_ByDate.[Amount], "qry_Income_ByDate", "[Category] = 'Credit'")," & _
" qry_Income_ByDate.[NQCG_Month]" & _
" INTO tbl_TmpTrans_ByDate FROM qry_Income_ByDate" & _
" GROUP BY qry_Income_ByDate.[Category], qry_Income_ByDate.[NQCG_Month];
Set db = Nothing
Last edited: