DateDiff?

T

Tim

I'm attempting to build a query that will become an end-
user report. What I'm attempting to do is find people
who have a free drink coming ([JDMAIN].[NUMBERFREE]>0)
and that works fine, but I'm unable to find who has made
a purchase within the last 30 days.

Is DateDiff wrong for this? Is there a better way? I'm
not sure my syntax is correct in the statement below
either. It's built in an SQL window, so that's what I
copied and pasted. I know it appears that I need a _ in
a few places, but in the SQL window, I don't.

SELECT [JDMAIN].[JDNAME] AS [Customer's Name]
FROM JDMain
WHERE (( [JDMAIN].[NUMBERFREE]>0) and(DateDiff
("m","d","yyyy", [DATEOFPURCH],NOW() < 31))
ORDER BY [JDMAIN].[JDNAME];

Thanks in advance.
 
J

Jeff Boyce

Tim

Check Access HELP for the syntax on DateDiff() function. You're SQL
statement uses "formatting" conventions.

Good luck

Jeff Boyce
<Access MVP>
 

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

Similar Threads


Top