• Status: Solved
  • Priority: Low
  • Security: Public
  • Views: 44
  • Last Modified:

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?
0
Ernest Grogg
Asked:
Ernest Grogg
  • 3
  • 2
1 Solution
 
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
 
Ernest GroggAuthor Commented:
they are date fields on a form and separate.  I will try the first solution and let you know...


thanks!
0
 
Ernest GroggAuthor Commented:
Works perfect.

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


»bp
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now