DateAdd

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

DateAdd("w",3,[received date]) where [received date] is a field with data in
it. I thought "w" was for weekday, but it add 2 days. I need to add 2
business days to the value. Why is this not working ?
 
DateAdd("w",3,[received date]) where [received date] is a field with data in
it. I thought "w" was for weekday, but it add 2 days. I need to add 2
business days to the value. Why is this not working ?

The DateAdd function knows NOTHING about business days. DateAdd("w",
1, Date()) will return Saturday's date if it's run on a Friday,
Sunday's date if it's run on Saturday, Christmas Day if it's run on
December 24.

Several MVP's and others have written workday functions. Check out
http://www.mvps.org/access/datetime/date0012.htm for example.

John W. Vinson[MVP]
 
kevinkirkland said:
DateAdd("w",3,[received date]) where [received date] is a field with data in
it. I thought "w" was for weekday, but it add 2 days. I need to add 2
business days to the value. Why is this not working ?

kevinkirkland,

I open Access, and go to Menus: Tools > Macros >
Visual Basic Editor (VBE).

I go the the Menus of the VBE: View > Immediate.

In the Immediate Window I type in: "? DateAdd("w",3,#01/10/2005#)",
without the quotes, and press enter.

The value returned is: 01/13/2005, or three days added.


In the Immediate Window, I type in: "? DateAdd("w",2,#01/10/2005#)",
without the quotes, and press enter.

The value returned is: 01/12/2005, or two days added.


If you need to advance only two weekdays, using a 2 instead of a 3 is
helpful.


Sincerely,

Chris O.
 
Back
Top