Solved

If-then-else statement for dates

Posted on 2014-02-19
4
265 Views
Last Modified: 2014-02-19
Not sure how to write vb If statement with dates such as:

 If txtCalDate is > 30 days  Then etc..



Thanks
0
Comment
Question by:zkoda
  • 2
  • 2
4 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 39871664
can you explain in plain english this line

 If txtCalDate is > 30 days


what is in "txtCalDate" ?
0
 

Author Comment

by:zkoda
ID: 39871680
Sorry - txtCalDate is the name of a field in a form.  If the date value is greater than 30 days then I'll take it from there.
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39871698
<If the date value is greater than 30 days > you need two dates to do a comparison?

assuming the second date is todays date


if datediff("d",Date(),me.txtCalDate) > 30 then



end if

or

if datediff("d",me.txtCalDate,Date()) > 30 then



end if
0
 

Author Closing Comment

by:zkoda
ID: 39871709
Just what I needed - Thanks
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now