Problems with dates in DCounts

G

Guest

The following code is supposed to count how many calls an agent has logged on
this particular day, but it is returning the total number of calls made ever.
Can anyone see a problem with the date part?

lblCalls.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
[Forms]![frm_CallLogger]![txtAgentName] & """ And """ & "[SaveDate]=
DateValue(now)""")

Also I also want to build the date filter on this DCount but I can't get it
to work:

lblUpsells.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
[Forms]![frm_CallLogger]![txtAgentName] & """ And " & "[OutcomeFlush]=" &
"true" And """ & "[SaveDate]= DateValue(now)""")

Thanks for any help you can offer!
 
D

Douglas J Steele

Try:

lblCalls.Caption = DCount("*", "tbl_Main", "[AgentName]=""" &
[Forms]![frm_CallLogger]![txtAgentName] & """ And """ & "[SaveDate]=" &
Format(Date, "\#mm\/dd\/yyyy\#"))

Same for the other one: put the date outside the quotes, use # delimiters
and format it as mm/dd/yyyy, regardless of what your Short Date format has
been set to. (the Format statement I'm using above does both the delimiter
and format for you)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top