Pull the Day of Week out of a Date

  • Thread starter Thread starter Ripper
  • Start date Start date
R

Ripper

I have a combo box where people select a start and end dat of a report. I
have the bound column set to the short date 9/4/09 and another column set to
the Long Date format Friday September 4, 2009. I set it up that way for the
user as they need to make the report from a Monday to a Friday and I didn't
want them to have to consult a calendar.

The long date, however, gets verbose. I was wondering if there was a way to
pull out only the day of the week in the second column. Any tips?
 
Exactly "how" will depend where (e.g., in a query, in a form, ...) you are
trying to do this.

Take a look at the Format() function -- I believe you could specify "dddd"
to see "day of week". There is also (see ACCESS HELP) a function related to
day-of-week that returns the name of the day, rather than the number ...

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I have a combo box where people select a start and end dat of a
report. I have the bound column set to the short date 9/4/09 and
another column set to the Long Date format Friday September 4,
2009. I set it up that way for the user as they need to make the
report from a Monday to a Friday and I didn't want them to have to
consult a calendar.

The long date, however, gets verbose. I was wondering if there
was a way to pull out only the day of the week in the second
column. Any tips?

These functions may help

Public Function LastDayOfWeek(ByVal mydate As Date, Optional FDOW As
Integer = 1)
LastDayOfWeek = DateAdd("d", 7 - Weekday(mydate, FDOW), mydate)
End Function

Public Function FirstDayOfWeek(ByVal mydate As Date, Optional FDOW As
Integer = 1)
FirstDayOfWeek = DateAdd("d", 1 - Weekday(mydate, FDOW), mydate)
End Function

FDOW is
1 Sunday (default)
2 Monday
3 Tuesday
etc..
 
Back
Top