Ask for weekdays only

  • Thread starter Thread starter Beth
  • Start date Start date
B

Beth

I have a query that looks for yesterday's data. This
poses a problem on Monday's as there is no data on Sunday,
causing an error. Instead of 'Date()-1' as my criteria,
how do I ask for weekdays only? Thank you.
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Try a WHERE clause like this (JET [Access] SQL):

WHERE WorkDate = IIf(WeekDay(Date())=2, Date()-3, Date()-1)

This criteria checks if the current system date is Monday (vbMonday =
2). If so, it subtracts 3 days from the current date; otherwise it
substracts 1 day.

- --
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQE31loechKqOuFEgEQLH3QCeKF4sA1b/368BSGU5vLXzniwm/MgAoI/n
rLSVtiVziuLGPtN5VI3h3S6J
=oXf0
-----END PGP SIGNATURE-----
 
Back
Top