Sorting strings by date question (ASP)
Sorting strings by date question (ASP):
I have an MS Access DB with a bunch of tables in it. Some of those tables are in a format like Jan03_checklist, Oct02_checklist, etc.
What I need to do is retrieve a list of these tables and put it into an an option select box. That's easy though, the trouble is that I need this option select list sorted by date..
This is the code I have to retrieve the tables:
But this sorts it alphabetically, so I get a list like :
Dec02_checklist
Feb02_checklist
Feb03_checklist
Jan02_checklist, etc.
The tableToText function there is just a function I wrote to convert things like "Dec02_checklist" into "December 2002"
So, any ideas on how to do this?
Thanks,
Val
I have an MS Access DB with a bunch of tables in it. Some of those tables are in a format like Jan03_checklist, Oct02_checklist, etc.
What I need to do is retrieve a list of these tables and put it into an an option select box. That's easy though, the trouble is that I need this option select list sorted by date..
This is the code I have to retrieve the tables:
Set DB = Server.CreateObject("ADODB.Connection")
DB.Open "phonecharge"
Set dbTableSchema = DB.OpenSchema(20)
Do While Not dbTableSchema.EOF
If InStr(dbTableSchema("TABLE_NAME"),"_checklist") Then %>
<option value="<%=dbTableSchema("TABLE_NAME")%>"><%=tableToText(dbTableSchema("TABLE_NAME"))%></option>
<%
End If
dbTableSchema.MoveNext
Loop
DB.Close
Set DB = Nothing
Set dbTableSchema = Nothing
But this sorts it alphabetically, so I get a list like :
Dec02_checklist
Feb02_checklist
Feb03_checklist
Jan02_checklist, etc.
The tableToText function there is just a function I wrote to convert things like "Dec02_checklist" into "December 2002"
So, any ideas on how to do this?
Thanks,
Val
