Help with Datediff

  • Thread starter Thread starter jake.ibood
  • Start date Start date
J

jake.ibood

Hello,

I need help with the following. I'm not a programmer, but need to fix
one thing. Can soeone tell me what's wrong with the following?

"SELECT * FROM TblEvents WHERE DATEDIFF('d', fldDateArchive, now()) <
0 & DATEDIFF('d', fldDatePublish, now()) > 0 ORDER BY fldDateEvent
ASC"

The idea is to publish only the events where the archive date isn't
due yet and where the publishdate is past (> 0).

Thanks!
 
Perhaps something like this:

SELECT TblEvents*
FROM TblEvents
WHERE ((fldDateArchive >= Date())
AND (publishDate < Date()))
ORDER BY fldDateEvent;

That will require only one call to get today's date for the whole query,
instead of 2 DateDiff() calls for every record.
 
Perhaps something like this:

SELECT TblEvents*
FROM TblEvents
WHERE ((fldDateArchive >= Date())
AND (publishDate < Date()))
ORDER BY fldDateEvent;

That will require only one call to get today's date for the whole query,
instead of 2 DateDiff() calls for every record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


news:0eed0dc3-6833-4dd5-baac-023d7a392b39@n77g2000hse.googlegroups.com...
Works like a charm. Thanks!!!
 
Back
Top