The code below is on one of my asp pages. I pass the name of a field that has an area code (1,2,3 etc), and a set of values from a multiple select box ("1,5,8"

and I build an SQL statement that limits the results in the report to just the selected area's.
Hope this helps!
Harry
'Check the passed variables to see if an SQL string needs to be built
strSQL = ""
'Process the Area selection if any, skip if *All* is selected
'Session("Area"

is the field name of the area in the database
'Request.Form("lstArea"

is the result of a multiple selection dropdown box
'ie. "1,2,5,7,9"
If Len(Session("Area"

) <> 0 and Request.Form("lstArea"

<> "All" Then
strTemp1 = Request.Form("lstArea"

intJ = 0
For intI = 1 to Len(strTemp1)
If Mid(strTemp1,intI,1) = "," Then
intJ = intJ + 1
End IF
Next
For intK = 1 to intJ
intL = Instr(strTemp1,","

strTemp2 = Mid(strTemp1, 1,intL - 1)
strTemp1 = Mid(strTemp1,intL + 2)
If Len(strSQL) <> 0 then strSQL = strSQL & " OR "
strSQL = strSQL & "{" & Session("Area"

& "} = " & strTemp2
Next
If Len(strSQL) <> 0 then strSQL = strSQL & " OR "
strSQL = strSQL & "{" & Session("Area"

& "} = " & strTemp1
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Set up the next line to modify the data to display in the report
IF len(strSQL) <> 0 Then
session("oRPT"

.recordselectionformula = strSQL
End If
On Error Resume Next
Session("oRpt"

.ReadRecords
If IsObject(session("oPageEngine"

) Then
Set Session("oPageEngine"

= Nothing
End If
Set Session("oPageEngine"

= Session("oRpt"

.PageEngine
Response.Redirect("SmartViewerActiveX.asp"
