Dcount

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to create a query that counts. I want to use it for a chart to
show how many times I do something every month. I do it in a text box using
the following code.
=DCount("dateModified","tbl-Offsites","DateDiff('m', datemodified, Now)=0")));

I put the following in a query, it seams to work but no results.

SELECT [tbl-Offsites].datemodified
FROM [tbl-Offsites]
WHERE
((([tbl-Offsites].datemodified)=DCount("dateModified","tbl-Offsites","DateDiff('m', datemodified, Now)=0")));

Thanks In Advance
 
Hi William,

you have too much in your where clause! but you are on the
right track. Also, you have 2 equal signs, you should just
have one)

I would use Date() instead of Now() since you are not doing
anything with the time

WHERE "DateDiff('m', [datemodified], #" & Date() & "#)=0";"

you can also do this

WHERE "format([datemodified],'yymm') = " _
& format(Date(),'yymm') & ";"

Have an awesome day

Warm Regards,
Crystal

MVP Microsoft Access
strive4peace2006 at yahoo.com
 
Back
Top