DateAdd Function to exclude weekend dates


G

Guest

I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but I get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
Ad

Advertisements

D

Douglas J. Steele

That KB article includes the code for the DateAddW function: it's in the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do not name
the module DateAddW: modules cannot be named the same as routines (subs or
functions)
 
G

Guest

Thank you for that - I had pasted it to a module but called it DateAddW so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



Douglas J. Steele said:
That KB article includes the code for the DateAddW function: it's in the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do not name
the module DateAddW: modules cannot be named the same as routines (subs or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but I get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
D

Douglas J. Steele

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you for that - I had pasted it to a module but called it DateAddW so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



Douglas J. Steele said:
That KB article includes the code for the DateAddW function: it's in the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do not
name
the module DateAddW: modules cannot be named the same as routines (subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

Thank you once again - I seem to have another problem using DateAddW

I was using dateAdd to work out my START DATE.

START DATE: DateAdd("d",-[TOTAL DAYS],[SHIP DATE]) - this worked fine.

Now I need it to work using only weekdays so I used the DateAddW formula again

START DATE: DateAddW(-[TOTAL DAYS],[SHIP DATE])

and the start date became a - number rather than a date!! I then tried

START DATE: DateAdd"(-[SHIP DATE],[TOTAL DAYS])

and the start date became an old random date of 08/10/1792

What am I doing wrong??

Please help






Douglas J. Steele said:
Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you for that - I had pasted it to a module but called it DateAddW so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



Douglas J. Steele said:
That KB article includes the code for the DateAddW function: it's in the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do not
name
the module DateAddW: modules cannot be named the same as routines (subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you missing
the + symbol before [START DATE]??




Douglas J. Steele said:
Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you for that - I had pasted it to a module but called it DateAddW so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



Douglas J. Steele said:
That KB article includes the code for the DateAddW function: it's in the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do not
name
the module DateAddW: modules cannot be named the same as routines (subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
Ad

Advertisements

D

Douglas J. Steele

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an odd
date another time), at least part of the problem is because that's lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web" or my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you missing
the + symbol before [START DATE]??




Douglas J. Steele said:
Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you for that - I had pasted it to a module but called it DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function: it's in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do
not
name
the module DateAddW: modules cannot be named the same as routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding but I
just don't fancy starting again as it was all going so well.

Thank you.

Douglas J. Steele said:
It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an odd
date another time), at least part of the problem is because that's lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web" or my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you missing
the + symbol before [START DATE]??




Douglas J. Steele said:
Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you for that - I had pasted it to a module but called it DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function: it's in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do
not
name
the module DateAddW: modules cannot be named the same as routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
D

Douglas J. Steele

It automatically adds the value. If the value's negative, it gives you that
many business days prior to the date. If the value's positive, it gives you
that many business days after the date. Putting a plus sign in front isn't
going to do anything for you: if the number is negative, you're still going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date - Total
Date gave an odd date. (If you meant to type Total Days, not Total Date,
then I'm not sure: I haven't looked that closely at the code to see whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding but I
just don't fancy starting again as it was all going so well.

Thank you.

Douglas J. Steele said:
It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an odd
date another time), at least part of the problem is because that's lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web" or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function: it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do
not
name
the module DateAddW: modules cannot be named the same as routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do
this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together from
a form. I then want to subtract the total manufacturing days (work days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

Douglas J. Steele said:
It automatically adds the value. If the value's negative, it gives you that
many business days prior to the date. If the value's positive, it gives you
that many business days after the date. Putting a plus sign in front isn't
going to do anything for you: if the number is negative, you're still going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date - Total
Date gave an odd date. (If you meant to type Total Days, not Total Date,
then I'm not sure: I haven't looked that closely at the code to see whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding but I
just don't fancy starting again as it was all going so well.

Thank you.

Douglas J. Steele said:
It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an odd
date another time), at least part of the problem is because that's lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web" or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function: it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application. Do
not
name
the module DateAddW: modules cannot be named the same as routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do
this?

Also once this is all done I need it to allow 0 or null values.

Please help.

Thank you

Kristal Henocq
 
D

Douglas J. Steele

I'm sorry: I've given you references to two routines that I know work. I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together
from
a form. I then want to subtract the total manufacturing days (work days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

Douglas J. Steele said:
It automatically adds the value. If the value's negative, it gives you
that
many business days prior to the date. If the value's positive, it gives
you
that many business days after the date. Putting a plus sign in front
isn't
going to do anything for you: if the number is negative, you're still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an
odd
date another time), at least part of the problem is because that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
Ad

Advertisements

G

Guest

Hello Douglas
I have been away on holiday and I am ready to tackly this problem now.

I have looked at your website and the codes. I think the one I need to use
is:

Public Function dhCountWorkdaysA(ByVal dtmStart As Date, ByVal dtmEnd As
Date, _
Optional adtmDates As Variant = Empty) _
As Integer

' Count the business days (not counting weekends/holidays) in
' a given date range.

and loads more code............................

I have saved that into a new Module.

Now I am stuck. Where I was using DateAddW last time with the KB code what
do I use now?

Please help.

Thank you for your patience. I only have 4 weeks to crack this before I go
on Maternity Leave.

Kind Regards

Kristal Henocq


Douglas J. Steele said:
I'm sorry: I've given you references to two routines that I know work. I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together
from
a form. I then want to subtract the total manufacturing days (work days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

Douglas J. Steele said:
It automatically adds the value. If the value's negative, it gives you
that
many business days prior to the date. If the value's positive, it gives
you
that many business days after the date. Putting a plus sign in front
isn't
going to do anything for you: if the number is negative, you're still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an
odd
date another time), at least part of the problem is because that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

Hello Douglas - me again - sorry had another look through and have now
obviously used all of the coding. I selected it all and copied it into a new
module.

So now where do I go from here.

What do I use instead of DateAddW and also to get the correct START DATE.

I think I am in above my head but I will give it a go.

Thank you.

Douglas J. Steele said:
I'm sorry: I've given you references to two routines that I know work. I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together
from
a form. I then want to subtract the total manufacturing days (work days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

Douglas J. Steele said:
It automatically adds the value. If the value's negative, it gives you
that
many business days prior to the date. If the value's positive, it gives
you
that many business days after the date. Putting a plus sign in front
isn't
going to do anything for you: if the number is negative, you're still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


It was going so well and now I have changed that I have a whole load of
errors and it still doesn't work. I am giving up for now and look at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and an
odd
date another time), at least part of the problem is because that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long) As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
I am running a query using the DateAdd function. It works fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
D

Douglas J. Steele

I believe I said you should have been using

DateAddW([START DATE], [days 10] + [days 20])

The equivalent with the code from
http://www.mvps.org/access/datetime/date0012.htm should be

dhAddWorkDaysA([days 10] + [days 20], [StartDate])

This, of course, assumes that both days 10 and days 20 have valid numbers in
them. To be safe, you should probably use

dhAddWorkDaysA(Nz([days 10],0) + Nz([days 20], 0), [StartDate])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Hello Douglas - me again - sorry had another look through and have now
obviously used all of the coding. I selected it all and copied it into a
new
module.

So now where do I go from here.

What do I use instead of DateAddW and also to get the correct START DATE.

I think I am in above my head but I will give it a go.

Thank you.

Douglas J. Steele said:
I'm sorry: I've given you references to two routines that I know work. I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the
problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together
from
a form. I then want to subtract the total manufacturing days (work
days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

:

It automatically adds the value. If the value's negative, it gives you
that
many business days prior to the date. If the value's positive, it
gives
you
that many business days after the date. Putting a plus sign in front
isn't
going to do anything for you: if the number is negative, you're still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total
Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


It was going so well and now I have changed that I have a whole load
of
errors and it still doesn't work. I am giving up for now and look
at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and
an
odd
date another time), at least part of the problem is because that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long)
As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access
Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and
sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are
you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your
application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message
I am running a query using the DateAdd function. It works
fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I
do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
G

Guest

Thank you but I am still having problems getting the start date.

I want SHIP DATE - TOTAL DAYS = START DATE (excluding weekends)

Can this be done?



Douglas J. Steele said:
I believe I said you should have been using

DateAddW([START DATE], [days 10] + [days 20])

The equivalent with the code from
http://www.mvps.org/access/datetime/date0012.htm should be

dhAddWorkDaysA([days 10] + [days 20], [StartDate])

This, of course, assumes that both days 10 and days 20 have valid numbers in
them. To be safe, you should probably use

dhAddWorkDaysA(Nz([days 10],0) + Nz([days 20], 0), [StartDate])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Hello Douglas - me again - sorry had another look through and have now
obviously used all of the coding. I selected it all and copied it into a
new
module.

So now where do I go from here.

What do I use instead of DateAddW and also to get the correct START DATE.

I think I am in above my head but I will give it a go.

Thank you.

Douglas J. Steele said:
I'm sorry: I've given you references to two routines that I know work. I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the
problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days together
from
a form. I then want to subtract the total manufacturing days (work
days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

:

It automatically adds the value. If the value's negative, it gives you
that
many business days prior to the date. If the value's positive, it
gives
you
that many business days after the date. Putting a plus sign in front
isn't
going to do anything for you: if the number is negative, you're still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total
Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


It was going so well and now I have changed that I have a whole load
of
errors and it still doesn't work. I am giving up for now and look
at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL DATE

Any thoughts?

When I get a chance I will look at your web site and use your coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time, and
an
odd
date another time), at least part of the problem is because that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As Long)
As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access
Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and
sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are
you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
Thank you for that - I had pasted it to a module but called it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your
application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message
I am running a query using the DateAdd function. It works
fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do I
do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
D

Douglas J. Steele

If you're trying to calculate the Start Date, then why did you have it in
your call to DateAddW?

What you needed before would have been

DateAddW([SHIP DATE], - [days 10] - [days 20])

What you need now would be

dhAddWorkDaysA(-Nz([days 10],0) - Nz([days 20], 0), [SHIP DATE])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you but I am still having problems getting the start date.

I want SHIP DATE - TOTAL DAYS = START DATE (excluding weekends)

Can this be done?



Douglas J. Steele said:
I believe I said you should have been using

DateAddW([START DATE], [days 10] + [days 20])

The equivalent with the code from
http://www.mvps.org/access/datetime/date0012.htm should be

dhAddWorkDaysA([days 10] + [days 20], [StartDate])

This, of course, assumes that both days 10 and days 20 have valid numbers
in
them. To be safe, you should probably use

dhAddWorkDaysA(Nz([days 10],0) + Nz([days 20], 0), [StartDate])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Hello Douglas - me again - sorry had another look through and have now
obviously used all of the coding. I selected it all and copied it into
a
new
module.

So now where do I go from here.

What do I use instead of DateAddW and also to get the correct START
DATE.

I think I am in above my head but I will give it a go.

Thank you.

:

I'm sorry: I've given you references to two routines that I know work.
I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the
problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days
together
from
a form. I then want to subtract the total manufacturing days (work
days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

:

It automatically adds the value. If the value's negative, it gives
you
that
many business days prior to the date. If the value's positive, it
gives
you
that many business days after the date. Putting a plus sign in
front
isn't
going to do anything for you: if the number is negative, you're
still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship
Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total
Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
It was going so well and now I have changed that I have a whole
load
of
errors and it still doesn't work. I am giving up for now and
look
at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did
SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL
DATE

Any thoughts?

When I get a chance I will look at your web site and use your
coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time,
and
an
odd
date another time), at least part of the problem is because
that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As
Long)
As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access
Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and
sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are
you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message
Thank you for that - I had pasted it to a module but called
it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together
for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW
function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your
application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Kristaltips" <[email protected]>
wrote
in
message
I am running a query using the DateAdd function. It
works
fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us

This says I have to add a user defined function, How do
I
do
this?

Also once this is all done I need it to allow 0 or null
values.

Please help.

Thank you

Kristal Henocq
 
Ad

Advertisements

G

Guest

I did that and now I just have an Error.

dhAddWorkDaysA(-Nz([days 10],0) - Nz([days 20], 0), [SHIP DATE]) = Error

If I tried the old way

DateAddW([SHIP DATE], - [days 10] - [days 20])

= the number would be number of days to be minused from SHIP DATE rather
than a date.
If you're trying to calculate the Start Date, then why did you have it in
your call to DateAddW? I thought that was the code/query to use as it works for all the other date formulas.



Douglas J. Steele said:
If you're trying to calculate the Start Date, then why did you have it in
your call to DateAddW?

What you needed before would have been

DateAddW([SHIP DATE], - [days 10] - [days 20])

What you need now would be

dhAddWorkDaysA(-Nz([days 10],0) - Nz([days 20], 0), [SHIP DATE])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Kristaltips said:
Thank you but I am still having problems getting the start date.

I want SHIP DATE - TOTAL DAYS = START DATE (excluding weekends)

Can this be done?



Douglas J. Steele said:
I believe I said you should have been using

DateAddW([START DATE], [days 10] + [days 20])

The equivalent with the code from
http://www.mvps.org/access/datetime/date0012.htm should be

dhAddWorkDaysA([days 10] + [days 20], [StartDate])

This, of course, assumes that both days 10 and days 20 have valid numbers
in
them. To be safe, you should probably use

dhAddWorkDaysA(Nz([days 10],0) + Nz([days 20], 0), [StartDate])

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Hello Douglas - me again - sorry had another look through and have now
obviously used all of the coding. I selected it all and copied it into
a
new
module.

So now where do I go from here.

What do I use instead of DateAddW and also to get the correct START
DATE.

I think I am in above my head but I will give it a go.

Thank you.

:

I'm sorry: I've given you references to two routines that I know work.
I
don't have the time to try and figure out why the KB's code doesn't.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Thank you once again - I have been looking at it too much.

So I understand that it automatically adds the value. I think the
problem
is that all my numbers are positive.

I meant to write Total Days not date.

What I am doing is adding together all the manufacturing days
together
from
a form. I then want to subtract the total manufacturing days (work
days)
from the SHIP DATE to give the START DATE.

So my Total Days is a positive number?

Thank you for you help and I hope you can help me solve it.

Kristal

:

It automatically adds the value. If the value's negative, it gives
you
that
many business days prior to the date. If the value's positive, it
gives
you
that many business days after the date. Putting a plus sign in
front
isn't
going to do anything for you: if the number is negative, you're
still
going
to be subtracting.

Assuming Total Date is a date, it's hardly surprising that Ship
Date -
Total
Date gave an odd date. (If you meant to type Total Days, not Total
Date,
then I'm not sure: I haven't looked that closely at the code to see
whether
there are bugs in it)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
It was going so well and now I have changed that I have a whole
load
of
errors and it still doesn't work. I am giving up for now and
look
at
other
ways.

How does it know to + or - if you do not have any symbols?

Also with the odd date that it was giving - it worked if I did
SHIP
DATE +
TOTAL DAYS but gave out an odd date if it was SHIP DATE - TOTAL
DATE

Any thoughts?

When I get a chance I will look at your web site and use your
coding
but I
just don't fancy starting again as it was all going so well.

Thank you.

:

It's not required (nor is a + sign required before [days 10])

As to your other question (about why it was a number one time,
and
an
odd
date another time), at least part of the problem is because
that's
lousy
code!

Function DateAddW (ByVal TheDate, ByVal Interval)

should be

Function DateAddW (ByVal TheDate As Date, ByVal Interval As
Long)
As
Date

For better alternatives, see
http://www.mvps.org/access/datetime/date0012.htm at "The Access
Web"
or
my
"Access Answers" column in the September, 2004 issue of Pinnacle
Publication's "Smart Access". You can download the column (and
sample
database) for free at
http://www.accessmvp.com/djsteele/SmartAccess.html

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


message
MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])

Hi Douglas me again - just looking at your above statement are
you
missing
the + symbol before [START DATE]??




:

Looking at that KB article, you should have:

MOVE ON BY 10: DateAddW([START DATE], [days 10])

To add the number of days from multiple fields, try:

MOVE ON BY: DateAddW([START DATE], [days 10] + [days 20])


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


in
message
Thank you for that - I had pasted it to a module but called
it
DateAddW
so
that is where I was going wrong.

The next problem I am having is that it works for the below

MOVE ON BY 10: DateAddW(+[days 10],[START DATE])

but how do I change it to add more than two field together
for
example
days 10 + days 20 + START DATE?



:

That KB article includes the code for the DateAddW
function:
it's
in
the
shaded area under Resolution.

Copy all of that and paste it into a module in your
application.
Do
not
name
the module DateAddW: modules cannot be named the same as
routines
(subs
or
functions)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


"Kristaltips" <[email protected]>
wrote
in
message
I am running a query using the DateAdd function. It
works
fine

MOVE ON BY: DateAdd("y",+[days 10],[START DATE])

but I would like it to exclude weekend dates.

I looked on the website below and they mentioned using
DateAddW
but
I
get
an error message of Undefined Funtion DateAddW

http://support.microsoft.com/kb/115489/en-us
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top