D
DS
This isn't returning a value...I'm sure it's my syntax.
I think it might be the CDDiscountWhere = 'A' part but then again.....
Any help appreciated.
Thanks
DS
Set rs = CurrentDb.OpenRecordset("SELECT
Sum(CDQuantity*CDPrice*(1-[CDDiscountPercent])) FROM " & _
"[MS Access;Database=\\Backoffice\C$\Warehouse\History.mdb].tblCheckDetails
" & _
"WHERE CDDiscountWhere = 'A' AND CDDiscountDP=2 And CDBizDay BETWEEN " &
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & _
"AND " & Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"),
dbOpenSnapshot)
Set rs2 = CurrentDb.OpenRecordset("SELECT
Sum(CDQuantity*CDPrice*(1-[CDDiscountPercent])) FROM " & _
"tblCheckDetails " & _
"WHERE CDDiscountWhere = 'A' AND CDDiscountDP=2 And CDBizDay BETWEEN " &
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & _
"AND " & Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"),
dbOpenSnapshot)
Me.TxtTaxableSales = Me.TxtSalesTotal = rs(0) + rs2(0)
rs.Close
rs2.Close
I think it might be the CDDiscountWhere = 'A' part but then again.....
Any help appreciated.
Thanks
DS
Set rs = CurrentDb.OpenRecordset("SELECT
Sum(CDQuantity*CDPrice*(1-[CDDiscountPercent])) FROM " & _
"[MS Access;Database=\\Backoffice\C$\Warehouse\History.mdb].tblCheckDetails
" & _
"WHERE CDDiscountWhere = 'A' AND CDDiscountDP=2 And CDBizDay BETWEEN " &
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & _
"AND " & Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"),
dbOpenSnapshot)
Set rs2 = CurrentDb.OpenRecordset("SELECT
Sum(CDQuantity*CDPrice*(1-[CDDiscountPercent])) FROM " & _
"tblCheckDetails " & _
"WHERE CDDiscountWhere = 'A' AND CDDiscountDP=2 And CDBizDay BETWEEN " &
Format(Forms!frmReportDates!TxtStart, "\#yyyy\-mm\-dd\#") & _
"AND " & Format(Forms!frmReportDates!TxtEnd, "\#yyyy\-mm\-dd\#"),
dbOpenSnapshot)
Me.TxtTaxableSales = Me.TxtSalesTotal = rs(0) + rs2(0)
rs.Close
rs2.Close