# Miscellaneous > Database Programming >  Clicking a record in a search result using HTML form

## Bart van den Eijnden

Hi,

I have a problem when I want to search my database using a HTML form which results in multiple answers. I get a list of the correct answers but then when I want to click one of the records to view the details (master/detail relationships), the list goes back to the initial list of functions, which is loaded automatically when no search is performed (select * from....). 
Two other objects (MyDb2, MyDb3) use the exported session variable &#34;Functienaam&#34; in the SQL statement.
To illustrate the problem (because it&#39;s pretty vague) I&#39;ll supply a part of the source code:

<%
        Set MyDb = Server.CreateObject(&#34;AspDB.Free&#34 :Wink:  
        MyDb.dbUnit = 305        
        Mydb.dbGridInc=-1        
        MyDb.dbDSN = &#34;ggl32&#34;
        MyDb.dbSQL = &#34;Select * from ggl32_main&#34;
        If Request(&#34;categorie&#34 :Wink:  <> &#34;&#34; then
        MyDb.dbSQL=&#34;SELECT * FROM ggl32_main WHERE Categorie = &#39;&#34; & Request
        (&#34;categorie&#34 :Wink:  & &#34;&#39;&#34;
        Response.Write(&#34;<script language=javascript>  
        document.catform.categorie.value=&#39;&#34 :Wink: 
        Response.Write(Request(&#34;categorie&#34 :Wink: ) 
        Response.Write (&#34;&#39;</script>&#34 :Wink: 
        End If
        If Request(&#34;Zoek&#34 :Wink:  <> &#34;&#34; then
        MyDb.dbSQL=&#34;SELECT * FROM ggl32_main WHERE Functienaam LIKE &#39;&#34; & 
        Request(&#34;Zoek&#34 :Wink:  & &#34;&#39;&#34;
        End If
        MyDb.dbmode=&#34;dual&#34;
        MyDb.dbGridDisplayflds=&#34;1,2,4,5&#34;
        MyDb.dbFormDisplayflds=-1
        MyDb.dbExportFlds = &#34;Functienaam&#34;
        MyDb.dbFormMemo = &#34;3x90,omschrijving,opmerkingen&#34;
        MyDb.dbNameMap=&#34;Omschrijving, Omschrijving Functie&#34;
        MyDb.dbColor=&#34;99FF99,FFFFFF,00CC00,000000&#34;
        MyDb.dbNavigationItem=&#34;top,prev,next,bottom&#3  4;
        MyDb.dbImageDir=&#34;images/&#34;
        MyDb.dbNavigationIcon=&#34;std&#34;
        MyDb.dbGridTableTag=&#34;BORDER=0&#34;
        MyDb.dbButtonAnchor=False
        MyDb.dbStatusbar=false
        MyDb.aspDBFree    
    %>

----------

