<% Dim cnDB ' As ADODB.Connection CheckSecurity Set cnDB = OpenDB() '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Retrieve ' ' This routine lists all records of this data type. It ' also provides actions to create, retrieve, update, and ' delete records. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Dim rsData ' As ADODB.Recordset Dim strSQL ' As String Dim strWhere ' As String Dim strURL ' As String Dim strTitle Dim strPrevOrg ' As String Dim strGroup Dim strSearch Dim strSearch2 Dim strSearchText Dim i DIM lngAccountID lngAccountID = Request.Cookies("mynetwork")("AID") strSearch2 = "" i = 0 strGroup = Request.querystring("g") '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' Check to see if more than one word was passed with the ' search string. ' '''''''''''''''''''''''''''''''''''''''''''''''''''''''''' If InStr(Request.querystring("q"), " ") > 0 Then strSearch = Left(Request.querystring("q"), (InStr(Request.querystring("q"), " ")-1)) strSearch2 = Mid(Request.querystring("q"), (InStr(Request.querystring("q"), " ")+1), 50) Else strSearch = Request.querystring("q") strSearch2 = "" End If If strSearch <> "" Then strWhere = "WHERE (tblOrgs.pkAccountID like " & lngAccountID _ & " AND (Organization Like " & DQ & "%" & strSearch & "%" & DQ & ")) " _ & "ORDER BY Organization" strTitle = "Organizations with '" & strSearch & "' in their name." Else If (strGroup <> "" AND strGroup <> "All") Then '''''''''''''''''''''''''''''''''''''''''''''' ' changes the SQL string to select by alphabet ' group (A,B,C,etc.) ' '''''''''''''''''''''''''''''''''''''''''''''' strWhere = "WHERE (tblOrgs.pkAccountID like " & lngAccountID _ & " AND (Left(Organization,1) Like " & DQ _ & strGroup & DQ & ")) ORDER BY Organization" strTitle = "Organizations that start with '" & strGroup & "'." Else ''''''''''''''''''''''''''''''''''''''''''''''' ' If neither the search box or alphabet group ' has been selected, SELECT Frequently Called ' Contacts ' ''''''''''''''''''''''''''''''''''''''''''''''' strWhere = "WHERE (tblOrgs.pkAccountID like " & lngAccountID & ") ORDER BY Organization" strTitle = "All Organizations" End If End If strSQL = "SELECT tblOrgs.*, tblContacts.* " _ & "FROM tblContacts RIGHT JOIN tblOrgs " _ & "ON tblContacts.pkOrgID = tblOrgs.pkOrgID " _ & strWhere ' strSQL = "SELECT * FROM tblOrgs " & strWhere Set rsData = cnDB.Execute(strSQL) WL "" & strTitle & "" ''''''''''''''''''''''''''''''''''' ' build search box ' ''''''''''''''''''''''''''''''''''' WL "
" WL "

Create New Organization" WL "     Search Orgs: " WL "

" '''''''''''''''''''''''''''''''''''''''''''''''''' ' adds the alphabet groups to the top of the page ' '''''''''''''''''''''''''''''''''''''''''''''''''' WL "

" WL "All - " WL "A - " WL "B - " WL "C - " WL "D - " WL "E - " WL "F - " WL "G - " WL "H - " WL "I - " WL "J - " WL "K - " WL "L - " WL "M - " WL "N - " WL "O - " WL "P - " WL "Q - " WL "R - " WL "S - " WL "T - " WL "U - " WL "V - " WL "W - " WL "X - " WL "Y - " WL "Z" WL "

" WL "" WL "" WL "" WL "" WL "" WL "" WL "" strPrevOrg = "" Do Until rsData.EOF ' If rsData("Organization") <> strPrevOrg Then '''''''''''''''''''''''''''''''''''''''''''''' ' Alternates row colors. In the future use ' Mod 2 for this task. ' ''''''''''''''''''''''''''''''''''''''''''''''' i = i + 1 If Round((i / 2),0) = (i / 2) Then WL "" Else WL "" End If WL "" WL "" WL "" WL "" WL "" WL "" ' strPrevOrg = rsData("Organization") rsData.MoveNext ' End If Loop rsData.Close CloseDB cnDB ' close database connections PrintFooter %>
Org NameContact Last NameCompany PhoneWeb
" _ & rsData("Organization") & "" WL "" & rsData("FirstName") _ & " " & rsData("LastName") & "" & rsData("OrgPhone") & "" _ & rsData("OrgWebsite") & "" WL " & DQ _
			& " WL "