I've been to two other Forums with this question and no one seems able to help.
This has been driving me up the wall for a couple of weeks. I set out to convert my comic collection check list (geek that I am!) from a static HTML table to a dynamic ASP-generated one.
My intention is that the final result should look like this (achieved statically):http://www.thestoryworks.com/publish...ng/wants63.htm
but it currently looks like this:http://www.tmcreative.co.uk/db/build...a_orig_fix.asp
The code I've created looks like this:
TheStoryWorks.com :: Comics :: Collecting :: Marvel 1963
Dim objCommand, objRS, varCounter, varMonthCount, varMonthCount10, varLoop, num, tName
Set objCommand = Server.CreateObject("ADODB.Command")
objCommand.ActiveConnection = strConnect
objCommand.CommandText = "SELECT Title.titleName, Item.issue, Item.month, Item.year, Item.have " & _
"FROM Title INNER JOIN Item ON Title.idTitle = Item.idTitle " & _
"WHERE (Item.year LIKE '63') ORDER BY titleName,month;"
objCommand.CommandType = adCmdText
Set objRS = objCommand.Execute
Set objCommand = Nothing
varMonthCount = 1
varMonthCount10 = 10
Response.Write "<table width='100%' border='0' cellspacing='0' cellpadding='2'>"
Response.Write "Date Published"
For varCounter = 1 to 9
Response.Write "0" & varMonthCount & "/" & objRS("year") & ""
varMonthCount = varMonthCount + 1
For varCounter = 10 to 12
Response.Write "" & varMonthCount10 & "/" & objRS("year") & ""
varMonthCount10 = varMonthCount10 + 1
For varCounter = 1 to 13
Response.Write " "
' RENDER BODY OF TABLE
num = 0
Do While Not objRS.EOF
Response.Write " 0 then
Response.Write ">" & objRS("titleName") & ""
' BEGIN TO RENDER THE ISSUE NUMBERS
varloop = 1
For varloop = 1 to 12
If objRS("month") <> varLoop then ' IS THE ISSUE IN THE RIGHT COLUMN?
Response.Write "" & objRS("issue") & "" ' IF SO, RENDER THE ISSUE NUMBER
'objRS.MoveNext ' MOVE TO THE NEXT ROW
Next ' GO ROUND THE LOOP AGAIN
num = num + 1
objRS.MoveNext ' EMERGENCY MOVENEXT
Set objRS = Nothing
The first objRS.MoveNext (currently commented out) is where I thought the command to move to the next row of the database SHOULD be, but when it's uncommented, I get an Exception error message.
By having the objRS.MoveNext just before the Loop, then at least the required data from the Access DB displays, but it displays incorrectly, placing each issue of a Comic Title on a separate line.
It SHOULD be placing all the issues of say, Amazing Spider-Man, for that year on a single row.
My question is: Why can I not put the objRS.MoveNext as part of an If...Then conditional command right after I've rendered the issue number in the For...Next loop?
(Really perceptive coders will also see another problem looming: How will the code handle the row change when there is no issue of a title published in December? I wish I knew ...)