Solved

If-then-else statement for dates

Posted on 2014-02-19
4
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
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 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
linked sql server tables - should I or shouldn't I and why 4 63
Balance after Repayment - 2 6 62
Can not open the Access Help ? 3 41
Return Data From Website in Access 6 59
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Familiarize people with the process of utilizing SQL Server views 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 Access…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

751 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