Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple Records Same Row

Status
Not open for further replies.

ybn1197

Technical User
May 20, 2002
12
US
I'm fairly new to ASP/Database and I'm having difficulty with a output format. I have a page that displays 2 fields of a recordset in a table. There are multiple recordsets in the table. What I have displaying when the page runs is a long, skinny table. What I would like is a shorter and wider table that would display multiple recordsets (preferably three) in the same row before moving to the next row. I've tried some things from 4guysfromrolla.com but I keep getting syntax errors on the output.
Here is the table and the repeat region as I have it. I work in Dreamweaver and use a Access database, which is, IMO, where I'm having problems with the above mentioned tutorials.
Code:
<% 
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF)) 
%>
<table border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
 <tr> 
  <td width=&quot;50&quot;><%=(Recordset1.Fields.Item(&quot;LocationID&quot;).Value)%></td>
  <td><%=(Recordset1.Fields.Item(&quot;LocationTitle&quot;).Value)%></td>
 </tr>
</table>
<% 
  Repeat1__index=Repeat1__index+1
  Repeat1__numRows=Repeat1__numRows-1
  Recordset1.MoveNext()
Wend
%>
Is there anyone that can help me turn this into a multiple columns/same row format. I'd hate to have one long skinny table with about 140 recordsets.
 
Hi ybn1197,

Try replacing the code above you've posted with this:

<table border=&quot;1&quot; cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;>
<tr>

<%
While ((Repeat1__numRows <> 0) AND (NOT Recordset1.EOF))
%>

<td width=&quot;50&quot;><%=(Recordset1.Fields.Item(&quot;LocationID&quot;).Value)%></td>
<td><%=(Recordset1.Fields.Item(&quot;LocationTitle&quot;).Value)%></td>

<%
Repeat1__index=Repeat1__index+1
Repeat1__numRows=Repeat1__numRows-1
Recordset1.MoveNext()
Wend
%>

</tr>
</table>


Also remember to changed your repeated region behavior to show only 3 records at once.

Hope this helps.

JoJoH

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top