I have this sql statement in a module
strSQL = "SELECT SUM (IVC_QTY * InvoiceUnitPrice)AS Sales"
strSQL = strSQL & " FROM tblSalesDbMaster"
strSQL = strSQL & " WHERE IVC_DATE >= " & dteBegin
strSQL = strSQL & " AND IVC_DATE <= " & dteEnd
Set rst = dbs.OpenRecordset(strSQL)
GetTotalSales = rst![Sales]
When run this statement it returns a null value. When I debug this statement and paste it into a query it returns the number I am looking for. Can someone explain why it works one way but not the other.
Thanks
strSQL = "SELECT SUM (IVC_QTY * InvoiceUnitPrice)AS Sales"
strSQL = strSQL & " FROM tblSalesDbMaster"
strSQL = strSQL & " WHERE IVC_DATE >= " & dteBegin
strSQL = strSQL & " AND IVC_DATE <= " & dteEnd
Set rst = dbs.OpenRecordset(strSQL)
GetTotalSales = rst![Sales]
When run this statement it returns a null value. When I debug this statement and paste it into a query it returns the number I am looking for. Can someone explain why it works one way but not the other.
Thanks