?
Solved

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

Posted on 2009-05-14
3
Medium Priority
?
221 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 2000 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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
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…
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…
Suggested Courses

649 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