[thelist] THE CODE FOR _______> Only display first 100 records from access

Paul Backhouse paul.backhouse at 2cs.com
Thu Jan 17 10:23:39 CST 2002


HERES THE CODE I AM USING AT PRESENT: (whether it helps you Im unsure)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>

<html>
<head>
<%
MdbFilePath = Server.MapPath("Addy.mdb")
Wire = "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & MdbFilePath & ";"

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.open Wire

%>
<title></title>
<style type="text/css">
<!--
td{
	font-family: verdana;
	font-size: 12px;
	color: #000000;
}
//-->
</style>
</head>
<body background="Labels.gif" bgcolor=#FFFFFF topmargin="16" leftmargin="15"
marginwidth="15"marginheight="16">
<%
Set objRS = Server.CreateObject("ADODB.Recordset")
strQuery = "SELECT
Title,Initials,Surname,Company,Address1,Address2,Address3,Town,Postcode FROM
MarketingFile"
objRS.open strQuery, objConn, , , adCmdText



%>


<%
If Not objRS.EOF Then

RecordCounter = 0


	Response.Write"<table border=0 cellpadding=0 cellspacing=0>"
	LinkCount = 0
	Do Until objRS.EOF
	 'change this 2 to any number you like:
	 If LinkCount Mod 2 = 0 Then
	  If LinkCount <> 0 Then Response.Write"</tr>"

	Title = objRS("Title")
	Surname = objRS("Surname")
	Address1 = objRS("Address1")
	Address2 = objRS("Address2")
	Address3 = objRS("Address3")
	Postcode = objRS("Postcode")
	Town = objRS("Town")

	If Title > "" Then
	Title = ""& Title &" "
	Else
	Title = ""
	End If
	If Address2 > "" Then
	Address2 = ""& Address2 &"<br>"
	Else
	Address2 = ""
	End If
	If Address3 > "" Then
	Address3 = ""& Address3 &"<br>"
	Else
	Address3 = ""
	End If

	%>
	<tr><td width=279 align=center valign=top>
		<table height=161 border=0 cellpadding=0 cellspacing=0>
		<tr>
		<td align=left valign=center>
		<b><%=Title%> <%=objRS("Initials")%>&nbsp;<%=Surname%><br></b>
		<%=objRS("Company")%><br>
		<%=Address1%><br>
		<%=Address2%>
		<%=Address3%>
		<%=Country%><br>
		<%=PostCode%>
		</td>
		</tr>
		</table>
	</td>
	<td width=7><img src=images/spacer.gif width=7 height=1 border=0></td>
	<%
	 Else
	Title = objRS("Title")
	Surname = objRS("Surname")
	Address1 = objRS("Address1")
	Address2 = objRS("Address2")
	Address3 = objRS("Address3")
	Postcode = objRS("Postcode")
	Town = objRS("Town")

	If Title > "" Then
	Title = ""& Title &" "
	Else
	Title = ""
	End If
	If Address2 > "" Then
	Address2 = ""& Address2 &"<br>"
	Else
	Address2 = ""
	End If
	If Address3 > "" Then
	Address3 = ""& Address3 &"<br>"
	Else
	Address3 = ""
	End If

	%>
	<td width=279 align=center valign=top>
		<table height=161 border=0 cellpadding=0 cellspacing=0>
		<tr>
		<td align=left valign=center>
		<b><%=Title%> <%=objRS("Initials")%>&nbsp;<%=Surname%><br></b>
		<%=objRS("Company")%><br>
		<%=Address1%><br>
		<%=Address2%>
		<%=Address3%>
		<%=Town%><br>
		<%=PostCode%>
		</td>
		</tr>
		</table>
	</td>


	<%
	 End If
	 LinkCount = LinkCount + 1
	 RecordCounter = RecordCounter + 1
	 If RecordCounter = 10 Then
	 	%>

	 	<tr>
	 	<td colspan=3><img src=spacer.gif width=1 height=33 border=0></td>
	 	</tr>

	 <%
RecordCounter = 0
End If
 objRS.MoveNext
Loop

Response.Write "</tr><tr><td colspan=3><img src=spacer.gif width=1 height=1
border=0></td></tr></table>"

objRS.Close
Set objRS = Nothing
Else Response.Write"<p>Sorry, no records were found!"
End If
%>





</body>
</html>





More information about the thelist mailing list