471,343 Members | 1,426 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,343 software developers and data experts.

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 3711


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
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.