Hello all
I wonder if someone could have a look at the following code and tell me where I am going wrong.
What I am trying to do is create a total monthly sales figure which only includes '+' sales figures, in other words that doesn't include any credit notes/payments on account etc that may have been issued, i have created two hidden boxes on my form that are the first date "firstdaymonth" and the last date "statedate", these dates change on the click of two button's - prev month and next month.
I have searched all over trying to get this correct and believe what I need is something similar to below but I just can't get it to calculate the required month only, it does calculate the year to date in some instances however.
this is what i have tried so far (the "saleinvtotalnet" is always "0" whenever a credit note has been issued and so I have used that as a possible way of identifying credit notes as well as figures > 0)
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvtotalnet] = 0" and "[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#")
or
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvtotalnet] > 0" and "[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#")
or
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#" and "[saleinvtotalnet] = 0")
I would be grateful for any help with this
Thanks
The nearest I have managed to get the total working is
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvdate] Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)")
this gives me the whole total but i cannot get it working when i add the extra criteria eg "[saleinvtotalnet] = 0"
I wonder if someone could have a look at the following code and tell me where I am going wrong.
What I am trying to do is create a total monthly sales figure which only includes '+' sales figures, in other words that doesn't include any credit notes/payments on account etc that may have been issued, i have created two hidden boxes on my form that are the first date "firstdaymonth" and the last date "statedate", these dates change on the click of two button's - prev month and next month.
I have searched all over trying to get this correct and believe what I need is something similar to below but I just can't get it to calculate the required month only, it does calculate the year to date in some instances however.
this is what i have tried so far (the "saleinvtotalnet" is always "0" whenever a credit note has been issued and so I have used that as a possible way of identifying credit notes as well as figures > 0)
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvtotalnet] = 0" and "[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#")
or
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvtotalnet] > 0" and "[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#")
or
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvdate] Between " & "#" & [Forms]![frmMonthlySalesControl]![firstdaymonth] & "#" & " and " & "#" & [Forms]![frmMonthlySalesControl]![statedate] & "#" and "[saleinvtotalnet] = 0")
I would be grateful for any help with this
Thanks
The nearest I have managed to get the total working is
=DSum("[saleinvtotal]","tblSalesInvoices","[saleinvdate] Between DateSerial(Year(Date()),Month(Date())-1,1) And DateSerial(Year(Date()),Month(Date()),0)")
this gives me the whole total but i cannot get it working when i add the extra criteria eg "[saleinvtotalnet] = 0"
Last edited: