Query previous weekday

skwilliams

Registered User.
Local time
Today, 15:41
Joined
Jan 18, 2002
Messages
516
I need a query to pull the previous weekday. Normally I'd just do =Date()-1 but this won't work on a Monday.

Thanks.
 
You will need to use the Weekday function to test for the day of the week

Brian
 
Can you give me an example?
 
The function is in help, maybe VBA help, but weekday(date) I think the syntax is gives the day of the week, but you should read the help.

Brian
 
I tried weekday but the syntax must be wrong. I'll just need to search around more.

Thanks for the help.
 
Here is the start of the help

Weekday Function


Returns a Variant (Integer) containing a whole number representing the day of the week.

Syntax

Weekday(date, [firstdayofweek])

The Weekday function syntax has these named arguments:

Part Description
date Required. Variant, numeric expression, string expression, or any combination, that can represent a date. If date contains Null, Null is returned.
firstdayofweek Optional. A constant that specifies the first day of the week. If not specified, vbSunday is assumed.
 
Hi -

Where Sunday =1 thru Saturday = 7

? date()
1/18/2010

? date() - IIf(WeekDay(date()) < 3, 1 + WeekDay(date()), 1)
1/15/2010

HTH - Bob
 
  • Like
Reactions: dcb

Users who are viewing this thread

Back
Top Bottom