Hi,
Sorry, i'm not sure how to describe this one - its not quite as simple as the title suggests ;)
OK, I have a database containing the following data:
name | id1 | note1 | date1 | id2 | note2 | date2 | id3 | note3 | date3 | . . . up to . . . id, note, date 20
record1| 3 | notex | 01/12/04 | and so on.... with the id# having a number in it, the note having a text message of some description, and the date being a date field.
Depending on the users input, the query pulls a certain record from the table (e.g. record1) and then lists id1, note1 and date1 in a three column row, then id2, note2 and date2 in the next row, and so on:
record1:
id1 | note1 | date1 |
id2 | note2 | date2 |
id3 | note3 | date3 |
id4 | note4 | date4 |
etc...
It does this using this script:
Dim intLoop
For intLoop = 1 to 21
If rs3("id" & intLoop) = 0 Then 'checks if id# has data in, if the id field is blank, then there will be no more rows printed
Response.Write " " 'prints some html to show the end of the table has been reached
Exit For 'exits the loop if this condition holds
End If
Response.Write "<tr bordercolor=""#fcb514""><t
d style=""font-weight:normal
;text-alig
n:center""
>" & rs4("text") & "</td><td style=""font-weight:normal
;text-alig
n:center""
>" & rs3("note" & intLoop) & "</td><td style=""font-weight:normal
;text-alig
n:center""
>" & Day(rs3("date" & intLoop)) & " " & MonthName(Month(rs3("date"
& intLoop)),1) & " " & Year(rs3("date" & intLoop)) & "</td>"
'that massive chunk prints id1, note1 and date1
Next 'it then goes to the next intLoop integer, and prints id2, note2, date2... and so on.
My problem is, I'm looking for a way to order the date field. Its not just as simple as adding an 'ORDER BY date' in the SQL query because there are up to 20 date fields on the screen. I'm looking to sort the date1, date2, date3 etc into order, and then print each one, one row at a time, printing that corresponding id# and note# with it.
This so far is stumping me. Has anyone got any ideas? Is it clear what I'm asking??
Thanks for your help :)
Jason
Start Free Trial