468,733 Members | 2,302 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,733 developers. It's quick & easy.

Comepare todays date with date + 60 days

Hello, I am having isues with the following:

I have two forms, a MAIN FORM with a SUB FORM:

Within the MAIN FORM, I have an unbound textbox (Date Format) and a
command button. Onload, the textbox defualts to Date().

The SUB FORM has a bound textbox (Date Format).

I am trying to create the code for the command button to compare the
two dates. If the SUB FORM textbox (containing the date) + 60 Days is
greater the MAIN FORMS date (todays date) then open a form, else open
another form.

The Pseudocode I have come up with is the following:

If Subform textbox + 60 days Mainform textbox then
Open Form 1
Else
Open Form 2

When I run the code, i don't think it is recognizing the date + 60
days. Any suggestions on the "+ 60 days" syntax?

Thank you in advance!

Mar 12 '07 #1
2 3583


When working with dates it's best to use the various date functions -
DateAdd, DateDiff, DatePart etc. While adding 60 to a date will add 60
days, the specific functions provide more uniform results as well as
being able to work with more than just days. I don't really see
anything logically wrong with your example, but if that's what you are
actually running, then no it won't work. Are you getting an error
message? Unexpected result?

Mar 12 '07 #2
On Mar 12, 2:26 pm, "storrboy" <storr...@sympatico.cawrote:
When working with dates it's best to use the various date functions -
DateAdd, DateDiff, DatePart etc. While adding 60 to a date will add 60
days, the specific functions provide more uniform results as well as
being able to work with more than just days. I don't really see
anything logically wrong with your example, but if that's what you are
actually running, then no it won't work. Are you getting an error
message? Unexpected result?
I used DateAdd, works great!!! Thank you!

Mar 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Gerry Viator | last post: by
5 posts views Thread by Vayse | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
xarzu
2 posts views Thread by xarzu | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.