User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 374,198 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,589 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser:
Views: 175 | Replies: 1
Reply
Join Date: Nov 2007
Posts: 9
Reputation: mgorecki is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
mgorecki mgorecki is offline Offline
Newbie Poster

Multiple "OR" process

  #1  
May 12th, 2008
Hello,
I'm a newbie at VB and am trying to get an 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
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Feb 2008
Location: Sivakasi, Tamilnadu, India
Posts: 292
Reputation: selvaganapathy is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 52
selvaganapathy's Avatar
selvaganapathy selvaganapathy is offline Offline
Posting Whiz in Training

Re: Multiple "OR" process

  #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

Dim TheDate As Date   ' Declare variables.
Dim Msg as String
TheDate = InputBox("Enter a date")
Msg = "Days from today: " & DateDiff("d", Now, TheDate)
MsgBox Msg
Last edited by selvaganapathy : May 12th, 2008 at 12:46 pm.
KSG
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Visual Basic 4 / 5 / 6 Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Visual Basic 4 / 5 / 6 Forum

All times are GMT -4. The time now is 5:13 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC