943,611 Members | Top Members by Rank

Ad:
May 12th, 2008
0

Multiple "OR" process

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
mgorecki is offline Offline
23 posts
since Nov 2007
May 12th, 2008
0

Re: Multiple "OR" process

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.
Reputation Points: 44
Solved Threads: 101
Posting Pro
selvaganapathy is offline Offline
547 posts
since Feb 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Extracting a zip file.
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Sendtoback problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC