I have an Access DB with 2 tables: tbldirectory and tblPracticeAreas.

I have a search page (practice-search.html) where the user can pick an attorney practice area from a drop down list. Upon choosing the practice area the user is taken to an ASP page (practice-search-results.asp)that displays a list of attorney names corresponding to that practice area.

I can display the attorney names just fine. What I need help with is displaying the attorneys' names as hyperlinks. I want the user to be able to click the name which would then take them to another ASP page displaying the complete and full set of information about that particular attorney (i.e., address, tel, fax, email, web, etc).

I've searched for similar questions here but can't seem to find the answer. Can anyone help out there?

Kind regards,
~gilroda

Here's the practice-search-results.asp page code: See bolded code below for where I want to insert the hyperlink.

<%

Dim Sql


Set dbCCBA = Server.CreateObject("ADODB.Connection")
strDBPath = Server.MapPath("directory.mdb")
dbCCBA.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBPath & ";"

Sql = "SELECT tbldirectory.fname, tbldirectory.lname, tbldirectory.ID_no, tbldirectory.firm, tbldirectory.address1, tbldirectory.city, tbldirectory.state, tbldirectory.zip, tbldirectory.phone, tbldirectory.fax, tbldirectory.email, tbldirectory.web, tbldirectory.pareas, tblPracticeAreas.PracticeName FROM tbldirectory, tblPracticeAreas"

If Request.Form("TypeSearch") = "Adoption" Then
Sql = Sql & " WHERE tbldirectory.ID_no=tblPracticeAreas.ID_no AND tblPracticeAreas.PracticeName='Adoption' ORDER BY tbldirectory.lname"
End If

If Request.Form("TypeSearch") = "Bankruptcy Law" Then
Sql = Sql & " WHERE tbldirectory.ID_no=tblPracticeAreas.ID_no AND tblPracticeAreas.PracticeName='Bankruptcy Law' ORDER BY tbldirectory.lname"
End If

If Request.Form("TypeSearch") = "Business Law" Then
Sql = Sql & " WHERE tbldirectory.ID_no=tblPracticeAreas.ID_no AND tblPracticeAreas.PracticeName='Business Law' ORDER BY tbldirectory.lname"
End If


Set rsCCBA = Server.CreateObject("ADODB.Recordset")
rsCCBA.Open Sql, dbCCBA, 3
%>
<%
If rsCCBA.BOF and rsCCBA.EOF Then%>

<h2 align="center" style="text-align: left">No results found.</h2>
<%Else%>


<%If Not rsCCBA.BOF Then%>

<h2 style="text-align: left">Here are the results of your search:&nbsp;&nbsp;"<%=rsCCBA("PracticeName")%>"</h2>
<br>
<%
Do While Not rsCCBA.EOF
%>

<div align="left">

<table BORDER="0" width="94%" cellpadding="3" style="text-align: left; border-collapse:collapse" cellspacing="1" height="21">
<tr>
<td width="500"><%=rsCCBA("fname")%>&nbsp;<%=rsCCBA("lname")%>&nbsp;&nbsp;<em><%=rsCCBA("firm")%></em>&nbsp;&nbsp;<%=rsCCBA("city")%>,&#32<%=rsCCBA("state")%></td>
</tr>
<tr>
<td width="500">Practice Areas: <%=rsCCBA("pareas")%></td>
</tr>
</table>

</div>
<hr color="#C0C0C0" size="1">
<% rsCCBA.MoveNext
Loop
%>
<p>
<%End If%>
<%End If%>
<%
rsCCBA.Close
dbCCBA.Close
%>

You should always use id columns (autonumbers) for these kind of things.
Smth like:

<%= "<a href=""show_details.asp?id=" & rsCCBA("tblPracticeAreas.ID_no") & """>" & rsCCBA("fname") & "&nbsp;" & rsCCBA("lname") & "</a>"
%>

Assumed "ID_no" is the primary key value of the guy those data you wanna show.

In the future:
There's no need to name your db tables "tbl....somthing". You would probably know anyway that it's a table.
Also keep table names in singular, not plural...is just good practice. :cheesy:

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.