Solved

VB6 - A quick way to filter by a set date?

Posted on 2009-05-14
3
193 Views
Last Modified: 2012-05-07
Okay, so I have these CSV files, a line example in some would be:

Test,LastName,152 Green Pointe,St.Kitts,Ontario,Canada,www.test.com,11/12/09
or
Test,LastName,152 Green Pointe,St.Kitts,Ontario,Canada,www.test.com,11-12-09
or
Test,LastName,152 Green Pointe,St.Kitts,Ontario,Canada,www.test.com,Nov 12 09
or
Test,LastName,152 Green Pointe,St.Kitts,Ontario,Canada,www.test.com,11/12/2009
etc.

Anyways.... As you see the only thing that changes is the date format. Some times its different in some areas, which makes it quite annoying at times.

Currently I have a program which grabs data depending on the text, and outputs the results in another text file. What I wanted to know is.. I am using the DateTime Picker control (MS Common Controls 6-2) to select two ranges of dates, for example 11-10-09 to 11-15-09.. I'd like it to a date range filter from 11-10-09 to 11-15-09 basicly, only grabbing from 11-10-09 to 11-15-09..

So basicly, I'd like to know if there is a simple way how I can grab all data in that date range using the above, with note that the date field may change its format. Because sometimes it uses words, sometimes numbers, and such like that. It is quite annoying but I don't have the power to adjust them all to one set format type.

Is there a grab date with little worry about the format? Or how would I go about doing it the best way possible? Thanks!
0
Comment
Question by:Valleriani
  • 2
3 Comments
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 500 total points
ID: 24393712
Will it always be the case that the dates will follow the format of Month first, then Day then Year?

11/20/2009 could be November 20, 2009, or it could also be December 10, 2009.

If that is GUARANTEED to always be true, then the VB6 function cDate(String_Expression) will convert each of the four forms that you show to a Date type value which is Novemeber 12, 2009.  Since you than have valid dates, theses can be used to filter on.

AW
0
 
LVL 7

Author Comment

by:Valleriani
ID: 24401901
CDate would work for t his yes! However the issue is..

How would I detect where the 'date' is now, since you need a valid 'date'..

As well some data is like 11-12-09 12:20PM or 12-12-09 16:01 ... FOr example, which does work in cdate, however, I want to ignore time. Can I just cut off after xx/xx/xx after checking? But I'd still need to see if its a 'valid date/time' at least first.
0
 
LVL 7

Author Closing Comment

by:Valleriani
ID: 31581558
Gotit nevermind, have another question to follow now!
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

813 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now