C
cager
I have a query that is pulling from a table the previous days data using
date()-1.
I have addressed the problem if I'm running this query on a Monday then the
table's last days data would be Friday (the last buisness day) so date()-1
would not work so I came up with this.
IIf(Weekday(Date())=2,Date()-3,Date()-1)
However, I thought what if there is a holiday like a 3 day weekend where my
company has Monday off so I come in on Tuesday looking to pull the prevous
days data. Well the previous data would be Friday (not Monday since we had
the day off) so my iif statement would not work.
Any idea how I can get this query to just pull the last "business day". My
company does have a table that has a list of all dates and whether it's a
business day (designated by "B" in the field), holiday (designated by "H" in
the field), or weekend (designated by "W" in the field).
date()-1.
I have addressed the problem if I'm running this query on a Monday then the
table's last days data would be Friday (the last buisness day) so date()-1
would not work so I came up with this.
IIf(Weekday(Date())=2,Date()-3,Date()-1)
However, I thought what if there is a holiday like a 3 day weekend where my
company has Monday off so I come in on Tuesday looking to pull the prevous
days data. Well the previous data would be Friday (not Monday since we had
the day off) so my iif statement would not work.
Any idea how I can get this query to just pull the last "business day". My
company does have a table that has a list of all dates and whether it's a
business day (designated by "B" in the field), holiday (designated by "H" in
the field), or weekend (designated by "W" in the field).