Solved

If-then-else statement for dates

Posted on 2014-02-19
4
269 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 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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
zero pad a access form field 2 15
Dlookup MSACCESS 5 24
Access Changing Number to Date with Seperator 5 21
Reference Controls on subforms 7 27
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

808 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