Dcount

W

williamr

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
 
C

Crystal

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
 

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