Solved

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

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
using Access 8 84
Sending a email via excel using vba 6 109
Recommendation vb6 to vb.net or others 14 205
Set email body to html using vbscript 6 71
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

749 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