HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a
problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next
month 03/01/03 and so on. In other words, I want to add one to the month and reset the
date. However, adding a given number of days (say 30) does not work because of the
variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker 7 8648
Look up Dateadd in help
You will use something like DateAdd("m", 1, "31-Jan-95") or DateAdd("m", 1,
"[youdatefieldname]")
HTH
David B
John Baker <Ba******@Verizon.net> wrote in message
news:qg********************************@4ax.com... HI:
I have a date, and am trying to do something that SHOULD be very simple -- but
finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and
then next month 03/01/03 and so on. In other words, I want to add one to the month and
reset the date. However, adding a given number of days (say 30) does not work because of
the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
Look at dateadd in the help, as in:
dateadd("m", 1, #1/1/04#)
Tom
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. .. HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
Thanks..
I guess it IS as easy as it appears!!!!
Regards
John Baker
John Baker <Ba******@Verizon.net> wrote: HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. .. HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and
2003 all integers)
Increment the month by one (2,1 and 2003)
Then convert into strings and concatenate them back into a string
inserting the "/" separator as necessary. ("1/01/2003")
Use DateValue function to convert back into a date value. John Baker lo************@hotmail.com (Brian) wrote in
news:f3**************************@posting.google.c om: John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. .. HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and 2003 all integers) Increment the month by one (2,1 and 2003) Then convert into strings and concatenate them back into a string inserting the "/" separator as necessary. ("1/01/2003") Use DateValue function to convert back into a date value.
Ouch!
--
Lyle
(for e-mail refer to http://ffdba.com/contacts.htm)
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. .. HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
John Baker
If memory serves, you should be able to use the DateAdd function and
simply do something like:
dim your_date as date
dim next_date as date
your_date = CDate("1/1/03")
next_date = DateAdd("m", 1, your_date)
Cheers,
Steve Cummings
Lyle Fairfield <Mi************@Invalid.Com> wrote in message news:<Xn*******************@130.133.1.4>... lo************@hotmail.com (Brian) wrote in news:f3**************************@posting.google.c om:
John Baker <Ba******@Verizon.net> wrote in message news:<qg********************************@4ax.com>. .. HI:
I have a date, and am trying to do something that SHOULD be very simple -- but finding a problem. Assume the date is 01/01/03. I wish to make the date 02/01/03, and then next month 03/01/03 and so on. In other words, I want to add one to the month and reset the date. However, adding a given number of days (say 30) does not work because of the variation in the number of days in a month.
Is there a simple way to increment dates by a month? If so what is it?
Thanks in advance.
regards
Not simple but here is what you do.
Break the date down using Month, Day and Year functions into (1,1 and 2003 all integers) Increment the month by one (2,1 and 2003) Then convert into strings and concatenate them back into a string inserting the "/" separator as necessary. ("1/01/2003") Use DateValue function to convert back into a date value.
Ouch!
Thanks. I found the other responses very educational. This discussion thread is closed Replies have been disabled for this discussion. Similar topics
2 posts
views
Thread by Jim |
last post: by
|
4 posts
views
Thread by Treetop |
last post: by
|
2 posts
views
Thread by markryde |
last post: by
|
2 posts
views
Thread by smcgrath via AccessMonster.com |
last post: by
| | | | | | | | | | | | | | | |