StartDate/EndDate Evaluation VBA

I have a form that has a date range.  if the start date is greater than 1 year then I need to change the type of form it returns

Also, if the end date is greater than 1 year, I need to do the same.

what would I use for the VBA?
Ernest GroggSecurity Management InfoSecAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Are these two different fields on the form?  And are they just text fields, or something else?


»bp
0
Bill PrewCommented:
If you have two text fields containing dates, then you can get the number of days between them as follows.  Then just compare that to 365 to see if it is a year or not...

DaysApart = DateDiff("y", DateValue(StartDate), DateValue(EndDate))

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ernest GroggSecurity Management InfoSecAuthor Commented:
they are date fields on a form and separate.  I will try the first solution and let you know...


thanks!
0
Ernest GroggSecurity Management InfoSecAuthor Commented:
Works perfect.

Thanks!
0
Bill PrewCommented:
Welcome, glad that helped.


»bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.