: Try this:
:
:
:
: <%
: Option Explicit
: Dim strConnect
: %>
: <!-- #include file="admin/connect_local.asp" -->
: <!-- METADATA TYPE="typelib"
: FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
:
: <HTML>
: <HEAD>
: <title>TheStoryWorks.com :: Comics :: Collecting :: Marvel 1963</title>
: <link href="style.css" rel="stylesheet" type="text/css">
: </pre></HEAD>
: <BODY>
:
: <%
:
: 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
: %>
: <%
: <table width="100%" border="0" cellspacing="0" cellpadding="2">
: <tr bgcolor="cccccc"><td class="bold">Date Published</td>
: <%
: For varCounter = 1 to 9
: %>
: <td class="bold">0<%=varMonthCount & "/" & objRS("year")%></td>
: <%
: varMonthCount = varMonthCount + 1
: Next
: For varCounter = 10 to 12
: %>
: <td class="bold"><%=varMonthCount10 & "/" & objRS("year")%></td>
: <%
: varMonthCount10 = varMonthCount10 + 1
: Next
: Response.Write "<tr>"
: For varCounter = 1 to 13
: Response.Write "<td> </td>"
: Next
: %>
:
: </tr>
:
: ' RENDER BODY OF TABLE
: <%
: num = 0
:
: Dim bgcolor
:
: Do While Not objRS.EOF
: ' WE WANT ALTERNATING ROWS, GREY AND WHITE, SO WE USE THE
: ' NUM VARIABLE TO TELL US WHAT COLOUR TO MAKE EACH TABLE ROW...
:
: If num mod 2 = 0 then
: bgcolor="#ffffff"
: Else
: bgcolor=#cccccc"
: End If
: %>
: <tr bgcolor="<%=bgcolor%>">
: <td class='bold'><%=objRS("titleName")%></td>
: <%
: ' 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?
: %> '
: <td align='center'> </td>
: <%
: Else ' IF SO, RENDER THE ISSUE NUMBER
: %>
: <td align="center"><%=objRS("issue")%></td>
: <%
:
: End If
: Next ' GO ROUND THE LOOP AGAIN
: %>
:
: </tr>
: <%
: num = num + 1
: objRS.MoveNext
: Loop
:
: objRS.Close
: Set objRS = Nothing
: %>
: </table>
: </BODY>
: </HTML>
: :
:
:
: cannot see what your page looks like now, because the links are
: broken.
: Anyway, try it, if it is not as you want, give us the database table
: details and and what you want to show.
:
:
Big "Thank You" for the reply.
I'm sorry the links are broken, as this would enable you to see what I was trying to achieve and what I was getting with the code I have. The code you've posted above doesn't deliver a substantially different result from what I already have.
Here's what I want the table to look like:
thestoryworks/publishing/comics/collecting/wants63.htm
(put www in front to make it a URL!)
Here's what MY CODE got me ...
tmcreative.co.uk/db/BuildTable03a_orig_fix.asp
(again with the www!)
Here's what your code delivered:
tmcreative.co.uk/db/BuildTable03b_PH_fix.asp
(www)
The Access db is here, so you should be able to download it ...
tmcreative.co.uk/db/admin/db/sw_com.mdb
(www)
I see that the main problem with the code is that the objRS.movenext instruction is in the wrong place. When I try to put that command in the right place (within the If...Then, right after the issue number is rendered) I get an error.
When I put the objRS.movenext just before the Loop, the server likes that syntax better and runs the page, but each issue number is rendered on a new line, instead of being rendered across the row, with the months there was NO ISSUE having a "-" instead.
You'll see what I mean when you look at the static version on thestoryworks.com
The problem arises because there's only 7 issues of Amazing Spider-Man in 1963 and the first few were issued bi-monthly. So when there's no issue for that month, I can't do objRS.movenext, I have to move to the next column and render the correct issue there.
It gets doubly tricky when we get to The Avengers line. Issue 1 is Sept, there's no Oct issue, issue 2 is Nov, then there's no Dec issue. BIG problem. Because the code doesn't render an issue for Dec, just a "-", there isn't an objRS.movenext either, so the ASP tries to render issue 10 of Fantastic Four in that slot instead.
Funny, when I started to code this I thought, "How hard can it be? I've done a bit of ASP before and this is really straightforward."
Guess I severely underestimated the trickiness of it all ...
I really do appreciate you taking time to look at this and I apologise that I wasn't able to figure out how to get the message board to render the example URLs properly.
Kind regards,
MattiMan