Monday, May 28, 2007

Don't use WeekdayName in Access

Avoid using the function WeekdayName() because it can give inconsistent results.

In the Immediate window I looked for the name of vbSunday and it returns måndag (Monday in Swedish).

? WeekdayName(vbSunday)
måndag

WeekdayName() uses vbUseSystemDayOfWeek and that can change depending on how you have set Windows to behave.

Workaround using either Format() or Weekday() since they use vbSunday as default value for the first day of the week or you can select what day should be the first day of the week.

This is a problem or bug even in the latest Microsoft Access 2007.

No comments:

Post a Comment