Solved

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

Posted on 2009-05-14
3
190 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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 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

20 Experts available now in Live!

Get 1:1 Help Now