Connecting Tech Pros Worldwide Forums | Help | Site Map

Month problem

John
Guest
 
Posts: n/a
#1: Nov 13 '05
Hi,
I am using a text box to input a date in a form and from that date I
want to show a new date in another text box which is one calendar week
later. As it is, it works fine untill I reach the end of the month, but the
month is not incrementing forward automatically. How do I fix this?

=(DateSerial(Year([PaymentDate]),Month([PaymentDate]),Day([PaymentDate]+7)))

Tia John



Allen Browne
Guest
 
Posts: n/a
#2: Nov 13 '05

re: Month problem


Try:
=DateAdd("d", 7, [PaymentDate])
or even:
=[PaymentDate] + 7

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"John" <lkjlkjlkj@jhk.net> wrote in message
news:onDVd.48741$Z14.36281@news.indigo.ie...[color=blue]
> Hi,
> I am using a text box to input a date in a form and from that date I
> want to show a new date in another text box which is one calendar week
> later. As it is, it works fine untill I reach the end of the month, but
> the
> month is not incrementing forward automatically. How do I fix this?
>
> =(DateSerial(Year([PaymentDate]),Month([PaymentDate]),Day([PaymentDate]+7)))
>
> Tia John[/color]


Devonish
Guest
 
Posts: n/a
#3: Nov 13 '05

re: Month problem



Try

DateAdd("w",7,[PaymentDate])


Ron Devenish

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
John
Guest
 
Posts: n/a
#4: Nov 13 '05

re: Month problem


Hi Folks,
this worked great for me, now can I replace the "w", with
"m" for month, and "y" for year and get similar results: eg. will
DateAdd("m",3,[PaymentDate]) give me a quarterly increment.
TIA, John


"Devonish" <no.spam@nowhere.com> wrote in message
news:42274e48$1_1@127.0.0.1...[color=blue]
>
> Try
>
> DateAdd("w",7,[PaymentDate])
>
>
> Ron Devenish
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it![/color]


Jeff Smith
Guest
 
Posts: n/a
#5: Nov 13 '05

re: Month problem


Year should be "yyyy". "y" gives you the day of the year. Go to the VBA help
file and search for the DateAdd function. Here it will show you all the
settings for each argument.

Jeff


"John" <lkjlkjlkj@jhk.net> wrote in message
news:eY7Wd.48847$Z14.36898@news.indigo.ie...[color=blue]
> Hi Folks,
> this worked great for me, now can I replace the "w", with
> "m" for month, and "y" for year and get similar results: eg. will
> DateAdd("m",3,[PaymentDate]) give me a quarterly increment.
> TIA, John
>
>
> "Devonish" <no.spam@nowhere.com> wrote in message
> news:42274e48$1_1@127.0.0.1...[color=green]
> >
> > Try
> >
> > DateAdd("w",7,[PaymentDate])
> >
> >
> > Ron Devenish
> >
> > *** Sent via Developersdex http://www.developersdex.com ***
> > Don't just participate in USENET...get rewarded for it![/color]
>
>[/color]


Closed Thread


Similar Microsoft Access / VBA bytes