<% Option Explicit%> <% Call HandleCookies() %> <% Sub DisplayVenue(intID, strName, strAddress, strLeader, strActivities) Response.Write("" & strName & " - " & strAddress ) If Trim(strLeader) <> "" Then Response.Write("
" & strLeader & "") End If Response.Write("
" & strActivities) Response.Write("") End Sub Sub DisplayResults() Dim i, j, k, intID, aryDetails, intFirstIndex, bShowVenue, strActivities, strLastActivity, strAddress Dim strName, strLeader, strSQL, arySplit, bFound arySplit = Split(Request("groups"), ",") strSQL = "SELECT Activities.Name As Activity, Towns.Name As Town, Venues.ID, Venues.Name, Venues.Address1, Venues.Address2, Venues.Postcode, Venues.Leader, Activities.ID " strSQL = strSQL & " FROM Towns INNER JOIN (Venues INNER JOIN (Activities INNER JOIN JoinActivity ON Activities.ID = JoinActivity.ActivityID) ON Venues.ID = JoinActivity.VenueID) ON Towns.ID = Venues.TownID" If intSearchType = 1 Then strSQL = strSQL & " WHERE JoinActivity.ActivityID In (" & Request("groups") & ")" Else strSQL = strSQL & " WHERE " For i=0 To UBound(arySplit) strSQL = strSQL & "Venues.ID IN (SELECT VenueID FROM JoinActivity WHERE ActivityID = " & arySplit(i) & ") " If i < UBound(arySplit) Then strSQL = strSQL & " AND " Next End If strSQL = strSQL & " ORDER BY Venues.Name, Activities.Name" ' Response.Write(strSQL) Response.Write("") objRS.Open strSQL, objConn, 0, 1 If Not objRS.EOF Then aryDetails = objRS.GetRows() objRS.Close intFirstIndex = 0 For i=0 To UBound(aryDetails, 2) intID = aryDetails(2, i) ' Determine if this is last record for this venue ---------------------------- bShowVenue = False If i=UBound(aryDetails, 2) Then bShowVenue = True Else If intID <> aryDetails(2, i+1) Then bShowVenue = True End If End If ' ---------------------------------------------------------------------------- If bShowVenue Then strActivities="" strLastActivity = "" For j=intFirstIndex To i If strLastActivity <> aryDetails(0, j) Then ' Highlight this activity if it's one of the ones we chose ---- bFound = False For k=0 To UBound(arySplit) If CInt(aryDetails(8, j)) = CInt(arySplit(k)) Then bFound = True Exit For End If Next If strActivities <> "" Then strActivities = strActivities & ", " End If If bFound Then strActivities = strActivities & "" & aryDetails(0, j) & "" Else strActivities = strActivities & aryDetails(0, j) End If ' ------------------------------------------------------------ End If strLastActivity = aryDetails(0, j) Next strAddress = "" If Trim(aryDetails(4, i)) <> "" Then strAddress = strAddress + aryDetails(4, i) End If If Trim(aryDetails(5, i)) <> "" Then If strAddress <> "" Then strAddress = strAddress + ", " strAddress = strAddress + aryDetails(5, i) End If If strAddress <> "" Then strAddress = strAddress + ", " strAddress = strAddress + aryDetails(1, i) If Trim(aryDetails(6, i)) <> "" Then If strAddress <> "" Then strAddress = strAddress + ", " strAddress = strAddress + aryDetails(6, i) End If strName = aryDetails(3, i) strLeader = aryDetails(7, i) Call DisplayVenue(intID, strName, strAddress, strLeader, strActivities) intFirstIndex = i+1 End If Next Response.Write("
") Else Response.Write("
There are no venues with that combination of groups.

") End If End Sub Sub OutputList() Dim arySplit, i, bFound strSQL = "SELECT ID, Name FROM Activities ORDER BY Name" objRS.Open strSQL, objConn, 0, 1 arySplit = Split(Request("groups"), ",") Response.Write("
") Response.Write("
Find venues that have
") If intSearchType = 1 Then Response.Write("") Else Response.Write("") End If Response.Write(" / ") If intSearchType = 2 Then Response.Write("") Else Response.Write("") End If Response.Write("
") Response.Write("of the following groups:
") Response.Write("") Response.Write("") Response.Write("
") End Sub Dim objRS, objConn, strSQL Dim bSubmitted Dim intSearchType bSubmitted = (Request("search") = "Search") If Request("searchtype") <> "" Then If Request("searchtype") = "1" Then intSearchType = 1 ElseIf Request("searchtype") = "2" Then intSearchType = 2 Else intSearchType = 1 End If Else intSearchType = 1 End If g_intCurrentTab = 4 Set objRS = Server.CreateObject("ADODB.RecordSet") Set objConn = Server.CreateObject("ADODB.Connection") objConn.Open("DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" & Server.Mappath("Faith Resources.mdb") & ";") %> <% Call OutputStyleSheetLine() %> Venue List - FAIR South Warwickshire
FAIR South Warwickshire
<% 'Tabs table OutputLine("") Call DisplayNavigationTabs(g_intCurrentTab) Response.Write("") OutputLine("
") %>
<% If bSubmitted And Request("groups") = "" Then Response.Write("
You need to specify at least one group
") End If Response.Write("
") Call OutputList() Response.Write("") If bSubmitted And Request("groups") <> "" Then Call DisplayResults() Else Response.Write(" ") End If Response.Write("
") objConn.Close Set objConn = Nothing Set objRS = Nothing %>
<% Call OutputPageFooter() %>