Hi, I have a search form with approx. 24 search fields. when the user performs a search they may choose any number of search critera (any number of fields) but not all of them. I need to capture these selected keywords into a table and then output & match the selected keywords with keywords from another table.<BR><BR>I have the search bit in asp but need to do all this in a single sproc. the bit I have is below:<BR><BR>&#060;%<BR>strSQL = "Select * from AppTest1 "<BR>CriteriaStr=" WHERE "<BR>for each item in Request.Form<BR> if item="save" or item="imageField.x" or item="imageField.y" then<BR> &#039;do nothing - these fields are not in the database<BR> else<BR> &#039;we start building a criteria string<BR> if Request.Form(item) &#060;&#062; "na" and len(Request.Form(item))&#060;&#062;0 then &#039;dont include na or blanks<BR> if right(CriteriaSTR,6) &#060;&#062; "WHERE " then &#039;do we need an and to join on from last query?<BR> CriteriaStr = CriteriaStr & " AND " & item & "=&#039;" & Request.Form(item) & "&#039;"<BR> else &#039;or is this the first criteria?<BR> CriteriaStr = CriteriaStr & item & "=&#039;" & Request.Form(item) & "&#039;"<BR> end if<BR> end if<BR> end if<BR>next<BR>&#039; thats it, combine the 2 strings to make your criteria.<BR>Response.Write strSQL & " " & CriteriaSTR & " " <BR>%&#062;<BR><BR>any help will be greatly appreciated <BR><BR>Cheers <BR>Carl<BR>