Your code should use:
... " WHERE " & FieldHead & " LIKE '" & Replace(TextBox, "'", "''") & "%'
Instead of:
... " WHERE " & FieldHead & " LIKE '" & TextBox & "%'"
Otherwise it will break if the user enters a single-quote into his search value. The normal way to show the results is to iterate through each row and column in the result set. However, you might find the following faster:
'Open the recordset and render the data in HTML format.
For Each objField In objRS.Fields
Call Response.Write("<td nowrap><b>" & _
Server.HtmlEncode(objField.Name) & "</b></td>" & vbCRLF)
Next
Call Response.Write("</tr>" & vbCRLF)
Call Response.Write("<tr>")
If Not objRs.eof Then
strData = objRS.GetString( , , "#<#/td#>##<#td#>#", _
"#<#/td#>##<#/tr#>##<#tr#>##<#td nowrap#>#", "#&#nbsp;")
strData = Replace(Replace(Replace(strData, "#&#", Chr(1)), "&", "&"), Chr(1), "&")
strData = Replace(Replace(Replace(strData, "#<#", Chr(1)), "<", "<"), Chr(1), "<")
strData = Replace(Replace(Replace(strData, "#>#", Chr(1)), ">", ">"), Chr(1), ">")
strData = "<td>" & Replace(Left(strData, Len(strData) - 15), "</tr>", "</tr>" & vbCRLF)
Call Response.Write(strData)
Else
Call Response.Write("<td colspan=""" & objRs.Fields.Count & """>No records found.</td></tr>" & vbCRLF)
End If
Call Response.Write("</table>" & vbCRLF)
The funny replace stuff is a quick way to get it to render each field as a separate HTML table cell. Andy