Multiple "OR" process

Reply

Join Date: Nov 2007
Posts: 14
Reputation: mgorecki is an unknown quantity at this point 
Solved Threads: 0
mgorecki mgorecki is offline Offline
Newbie Poster

Multiple "OR" process

 
0
  #1
May 12th, 2008
Hello,
I'm a newbie at VB and am trying to get some help with a process. My code will check an Excel file for dates and store them in a number of variables. Then I want to be able to compare those dates to the current date. I was thinking about using "Case", but is there a smoother, better way to do this? What I want is to basically say, "If any of these dates meet the criteria, then do something."

Thanks,
Mark
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 509
Reputation: selvaganapathy is an unknown quantity at this point 
Solved Threads: 88
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Pro

Re: Multiple "OR" process

 
0
  #2
May 12th, 2008
Hi
You can use DateDiff Function to Compare dates
DateDiff(interval, date1, date2)

Interval may be

yyyy -- Year
m - Month
y - Day of year
d - Day
w - Weekday
ww - Week
h - Hour
n - Minute
s - Second

Example

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Dim TheDate As Date ' Declare variables.
  2. Dim Msg as String
  3. TheDate = InputBox("Enter a date")
  4. Msg = "Days from today: " & DateDiff("d", Now, TheDate)
  5. MsgBox Msg
Last edited by selvaganapathy; May 12th, 2008 at 1:46 pm.
KSG
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC