<html>
<head>
<title>Labels</title>
<style>
<!--
div.Section1
{page:Section1;}
p.MsoNormal
{mso-style-parent:"";
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman";
margin-left:0in; margin-right:0in; margin-top:0in}
p.DotNetGnat { page-break-before: always }
-->
</style>
<meta name="blah" content="Labels">
</head>
<%
'put whatever response.contenttype you want...word or excel
'declare any variables
Set rsObj = Server.CreateObject("ADODB.Recordset")
Set MdConnection = Server.CreateObject("ADODB.Connection")
MdConnection.ConnectionString = "your connection string"
MdConnection.Open
sql = "your query"
rsObj.Open sql, MdConnection
If rsObj.EOF AND rsObj.BOF Then
Response.Write "Sorry. No records returned for your search criteria"
Else
%>
<body>
<div class="Section1">
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="181">
<%
count = 0
myMod = 0
do while not rsObj.EOF
myMod = count mod 3
if (count) MOD 30 = 0 then %>
</table>
<p class='DotNetGnat' align='center'> </p>
<table border="0" cellspacing="0" cellpadding="0" style="border-collapse: collapse" height="181">
<%End if
'Do we need to start a new row?
if (myMod = 0) then Response.Write "<tr style=""height: 1.0in"">"
'Write table data cell here
Response.Write "<td width=""257"" style=""width: 192.75pt; height: 1.0in; padding-left: .75pt; padding-right:.75pt; padding-top: 0in; padding-bottom: 0in"">"
Response.Write "<p class=""MsoNormal"" align=""center"" style=""margin-top:0in;margin-right:5.3pt;margin-bottom:0in;margin-left:5.3pt;margin-bottom:.0001pt;text-align:center"">"
Response.Write"<b><span style=""font-family: Arial"">" & rsObj("whatever")&"</span></b></p>"
Response.Write "<p class=""MsoNormal"" align=""center"" style=""margin-top:0in;margin-right:5.3pt;margin-bottom:0in;margin-left:5.3pt;margin-bottom:.0001pt;text-align:center"">"
Response.Write "<span style=""font-family: Arial""> " & rsObj("whatever")&"</span></p>"
Response.Write "<p class=""MsoNormal"" align=""center"" style=""margin-top:0in;margin-right:5.3pt;margin-bottom:0in;margin-left:5.3pt;margin-bottom:.0001pt;text-align:center""> </p>"
Response.Write "<p class=""MsoNormal"" align=""center"" style=""margin-top:0in;margin-right:5.3pt;margin-bottom:0in;margin-left:5.3pt;margin-bottom:.0001pt;text-align:center""> </td>"
'Do we need to end a the table row?
if (myMod = 2) then Response.Write "</tr>"
count = count + 1
rsObj.MoveNext
loop
'finish the last table row here
select case myMod
case 0
'need 2 empty cells and close table row
Response.Write "<td width=""257"" style=""width: 192.75pt; height: 1.0in; padding-left: .75pt; padding-right:.75pt; padding-top: 0in; padding-bottom: 0in""> </td><td width=""257"" style=""width: 192.75pt; height: 1.0in; padding-left: .75pt; padding-right:.75pt; padding-top: 0in; padding-bottom: 0in""> </td></tr>"
case 1
'need 1 empty cell and close table row
Response.Write "<td width=""257"" style=""width: 192.75pt; height: 1.0in; padding-left: .75pt; padding-right:.75pt; padding-top: 0in; padding-bottom: 0in""> </td></tr>"
case 2
'nothing else needed
end select
%>
</table>
<%
rsObj.Close
End if
%>
</body>
</html>