criteria for Date Diff

  • Thread starter margaret hannah
  • Start date
M

margaret hannah

I posted earlier ... I needed to have a beginning date and
an ending date and ya'll helped to figure out how to have
the program figure 7 days out. That works great.

Now a another question to go with this. Is there anyway
for the program to look at the date and let the user know
if it is not a Monday. In other words, my beginning date
should always be Monday.

Any help would be appreciated.
 
T

Tom Ellison

Dear Margaret:

The DatePart function has an "interval" parameter which, when set to
"w" returns a day of the week 1 - 7 for Sunday - Saturday, so Monday
would be 2. You could use this to test whether the day is on Monday
and also to correct from any day of the week to Monday using:

DateAdd("d", YourDate, 2 - DatePart ("w", YourDate))

This will correct any date [YourDate] to be Monday of the same week,
adding 1 day to Sunday or subtracting 5 days from Saturday, for
instance.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
G

Guest

Create a control on your form and put this in the control
source:
=Format([Date],"dddd")
The [Date] is the name of your date control...
John
 
G

Guest

Thank you for your help. That worked.

Thanks again for your time.
-----Original Message-----
Dear Margaret:

The DatePart function has an "interval" parameter which, when set to
"w" returns a day of the week 1 - 7 for Sunday - Saturday, so Monday
would be 2. You could use this to test whether the day is on Monday
and also to correct from any day of the week to Monday using:

DateAdd("d", YourDate, 2 - DatePart ("w", YourDate))

This will correct any date [YourDate] to be Monday of the same week,
adding 1 day to Sunday or subtracting 5 days from Saturday, for
instance.

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts


I posted earlier ... I needed to have a beginning date and
an ending date and ya'll helped to figure out how to have
the program figure 7 days out. That works great.

Now a another question to go with this. Is there anyway
for the program to look at the date and let the user know
if it is not a Monday. In other words, my beginning date
should always be Monday.

Any help would be appreciated.

.
 
Top