Using Dcount to count records with todays date always returns zero

smercer

Registered User.
Local time
Tomorrow, 10:45
Joined
Jun 14, 2004
Messages
442
Hi all

I am having a problem with a Dcount that returns zero when counting the todays records even though there are records with todays date.

here is my code:

Code:
Total_Each_Book_Count = DCount("Book_Id", "tbl_Sales_Each_Book_Completed", "Date_Sold = " & Date)

"Total_Each_Book_Count" is a variable

I have tried to have a query count the records but I need to write code for when there are zero records.

Does any one have any ideas?

Thanks in advance
 
Last edited:
s,

Punctuation:

Code:
Count = DCount("Book_Id", "tbl_Sales_Each_Book_Completed", "Date_Sold = #" & Date & "#")

Wayne
 
Thanks wyane

I got that one working but later got another problem with a Dsum.

Code:
Miscell_Sold = DSum("Quantity", "tbl_Sales_Miscell_Complete_Sold", "Sold_Date = #" & Date & "#")

I get error message "Invalid use of Null" error no. 94

it only works (sums all) when I take out the critera. Whats wrong here?

thanks in advance
 
S,

Miscell_Sold = Nz(DSum("Quantity", "tbl_Sales_Miscell_Complete_Sold", "Sold_Date = #" & Date & "#") , 0)

Wayne
 

Users who are viewing this thread

Back
Top Bottom