[AccessD] check weekday

Drew Wutka DWUTKA at marlow.com
Wed Dec 3 13:06:23 CST 2003


What's with changing the start of the week from Saturday to Sunday?  The
second argument of WeekDay tells it where to consider the first day of the
week.  If you are trying to set a date to Mon - Fri, and you want the date
to be Friday if it turns out to be Sat or Sun, then you could do this:

Dim dtMyDate As Date
dtMyDate=Date()
If WeekDay(dtMyDate,2)>5 Then dtMyDate=dtMyDate-WeekDay(dtMyDate,7)

That should do it....

Drew

-----Original Message-----
From: Oleg_123 at xuppa.com [mailto:Oleg_123 at xuppa.com]
Sent: Wednesday, December 03, 2003 11:30 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] check weekday


is there a shorter way of doing this ?

dtEdate = Format(Now() - 3, "mm-dd")

If WeekDay(dtEdate, vbSaturday) Then
    dtEdate = dtEdate - 1
ElseIf WeekDay(dtEdate, vbSunday) Then
    dtEdate = dtEdate - 2


-----------------------------------------
Get Breaking News from CNN, ABC, NBC, CBS Now.
http://www.xuppa.com/news/?link=webmail


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list