Solved

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

Posted on 2009-05-14
3
207 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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