Using Weekday and WeekdayName Function Access Database Tips from Xlteq
The Weekday function returns an integer representing a day of the week.
It has one optional setting, FirstDayOfWeek. This allows you to alter which day represents the first day of the week. If nothing is specified, vbSunday is assumed.
The function can be used in SQL as well as VBA.
Will return the integer 3, since today is Wednesday.
To make use of this function, you can use a similar function name called.
WeekdayName ( weekday [, abbreviate ] [, firstdayofweek ] )
The WeekdayName function returns a string indicating the specific day of the week.
It has two optional settings, [abbreviate] and [FirstDayOfWeek].
[Abbreviate] (True/False) returns an abbreviated name if set to True.
[FirstDayOfWeek] represents the first day of the week.
This allows you to alter which day represents the first day of the week. If nothing is specified, vbSunday is assumed.
We can use the WeekdayName function in SQL or VBA. The weekday represents a number between 1 and 7 (see above).
WeekdayName(3) would return Wednesday.
Example using WeekdayName and Weekday
strDay = WeekdayName(Weekday,2)
The 2 represents Monday being the first day of the week.