[thelist] sorting recordset problems
Ken Schaefer
Ken at adOpenStatic.com
Wed Jan 4 18:57:05 CST 2006
I would also recommend rewriting the filenames. However, if you don't, then
my suggestion would involve some string manipulation:
a) grab the YY part
b) look at what's left. Two digits = DM. Three digits is, unfortunately
ambiguous (e.g. is 11105 1st Nov, or 11th Jan?). Four digits is DDMM
c) create a string that YYYYMMDD
d) add this value to an extra field in your recordset
e) use the Recordset's .Sort method to sort on this field.
Cheers
Ken
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Pringle, Ron
Sent: Thursday, 5 January 2006 7:24 AM
To: 'thelist at lists.evolt.org'
Subject: Re: [thelist] sorting recordset problems
> Off the top of my head:
>
> * sorting in VBScript can be a nightmare
> * can you sort your query by a substring of the file name, or by two
> substrings?
> * for the month, you'd also have to include a CASE statement so you
> could sort descending on the number of the month. There's no
> logical way
> to sort the names of the months.
>
> Anywhere I'm allowed (and some places I'm not) I enforce
> CCYYMMDD dates
> exclusively, to sorting is simple and conversion to other formats
> relatively simple.
>
> joel
Joel-
Thanks for the response. Yes, I'm thinking I may need to rewrite the file
names, as it'd be a hell of a lot easier, however, there are thousands of
these files already in existence from before my time. I think I'll approach
it that way though, as I'm sure it will save me down the road.
Ron
More information about the thelist
mailing list