<% browserLevel = Request.ServerVariables("HTTP_USER_AGENT") if (instr(1,browserLevel,"MSIE 4") > 0) or (instr(1,browserLevel,"MSIE 5") > 0) or (instr(1,browserLevel,"MSIE 6") > 0) then useDivs = true else useDivs = false end if Private Function iif(boolTest, ifTrue, ifFalse) If booltest Then iif = ifTrue Else iif = ifFalse End If End Function Private Function StringExists(theString) If IsNull(Trim(theString)) or (Trim(theString) = "") or IsEmpty(Trim(theString)) Then StringExists = False Else StringExists = True End If End Function Private Function WriteCell(myBoolean, formField, dataField, fieldSize) If myBoolean Then fieldLength = Len(Trim(RSSites(dataField))) if IsNull(fieldLength) Then fieldLength = fieldSize end if 'WriteCell = "" Select Case formField Case "PID" If StringExists(RSSites(dataField)) Then outputString = "" & RSSites(dataField) & "" Else outputString = "" End If Case "ContactEMail" If StringExists(RSSites(dataField)) Then outputString = "" & RSSites(dataField) & "" Else outputString = "" End If Case Else If StringExists(RSSites(dataField)) Then outputString = RSSites(dataField) Else outputString = "N/A" End If End Select WriteCell = "" & iif(StringExists(outputString), outputString, "N/A") & "" Else If StringExists(Request(formField)) Then WriteCell = "" Else WriteCell = "" End If End If End Function Private Function WriteRadio(myBoolean, formField, dataField) StringYesChecked = "" StringNoChecked = "" StringNeitherChecked = "" If myBoolean Then If RSSites(dataField) Then WriteRadio = StringYesChecked Else WriteRadio = StringNoChecked End If Else If StringExists(Request(formField)) Then If Request(formField) Then WriteRadio = StringYesChecked Else WriteRadio = StringNoChecked End If Else WriteRadio = StringNeitherChecked End If End If End Function Private Function WriteSelect(myBoolean, formField, dataField) If myBoolean Then If StringExists(RSSites(dataField)) Then responseString = "" & RSSites(dataField) & "" Else responseString = "N/A" End If Else set theList = conn.execute("SELECT [" & dataField & "] FROM [Available Sites] GROUP BY [" & dataField & "] ORDER BY [" & dataField & "]") responseString = "" set theList = nothing End If WriteSelect = responseString End Function set conn = server.createobject ("ADODB.Connection") conn.open "EcDevDB" ' ... SET UP TOOLS NEEDED FOR QUERIES set myCmd = server.createobject ("ADODB.Command") set myCmd.Activeconnection = conn set sampleRecord = conn.execute("SELECT TOP 1 * FROM [Available Sites]") qryString = "SELECT * FROM [Available Sites] WHERE ([Id] > 0)" ' strings strFieldNameArray = array("BuildingName", "Address", "City", "PID", "Zoning", "ContactName", "ContactCompany", "ContactCity", "Sewer", "Water", "Electric", "NatGas", "OtherUtil", "PrimaryMaterial", "PrimaryUse", "Comments") strDbFieldArray = array("Building Name", "Address", "City", "Parcel Number", "Zoning", "Contact Name", "Contact Company", "Contact City", "Sewer Provider", "Water Provider", "Electric Provider", "Natural Gas Provider", "Other Utilities", "Primary Material", "Primary Use", "Comments") ' booleans bFieldNameArray = array("HighVisibility", "EntZone", "RailAccessOnSite", "InPark", "MultiTenant", "CanSubdivide", "Lease", "Purchase", "LeasePurchase", "Sprinkler", "PlantAC", "OfficeAC", "RaisedFloor") bDbFieldArray = array("High Visibility", "Ent Zone", "Rail Access on Site", "In Park", "Multi Tenant", "Can Subdivide", "Lease", "Purchase", "Lease Purchase", "Sprinkler", "Plant AC", "Office AC", "Raised Floor") ' single-digit precision checks (ie: within x percent) sngFieldNameArray = array("CommercialAirportMiles", "MajorHighwayMiles", "MajorPortMiles", "RailTerminalMiles", "SiteSizeAcres", "ParkingSpaces", "EaveHeightFt", "MaxCeilingHeightFt", "DockTruckDoors", "FloorTruckDoors", "FloorThicknessIn", "TotalSqFeet", "FinishedOfcSqFt", "AvailMfgSqFt", "AvailSqFeet", "AvailWhseSqFt") sngDbFieldArray = array("Commercial Airport Miles", "Major Highway Miles", "Major Port Miles", "Rail Terminal Miles", "Site Size Acres", "Parking Spaces", "Eave Height Ft", "Max Ceiling Height Ft", "Dock Truck Doors", "Floor Truck Doors", "Floor Thickness In", "Total Sq Feet", "Finished Ofc Sq Ft", "Avail Mfg Sq Ft", "Avail Sq Feet", "Avail Whse Sq Ft") sngToleranceArray = array(0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.3, 0.05, 0.05, 0.05, 0.05, 0.05) ' integer checks (ie: within +/- x units) lngFieldNameArray = array("YearBuilt", "NumberOfFloors") lngDbFieldArray = array("Year Built", "Number of Floors") lngToleranceArray = array(5, 1) Select Case Request("Action") Case "Query" For i = 0 to UBound(strFieldNameArray) theFieldName = strFieldNameArray(i) dbFieldName = strDbFieldArray(i) set targetField = sampleRecord.Fields(dbFieldName) If StringExists(Request(theFieldName)) Then If dbFieldName="Comments" Then qryString = qryString & " AND ([" & dbFieldName & "] Like '%" & Trim(Request(theFieldName)) & "%')" Else qryString = qryString & " AND ([" & dbFieldName & "] Like ?)" 'response.write(theFieldName & "
" & targetField.type & "
" & 1 & "
" & Len(Trim(Request(theFieldName))) + 2 & "
" & "%" & Trim(Request(theFieldName)) & "%" & "
") myCmd.Parameters.Append myCmd.CreateParameter(theFieldName, targetField.type, 1, targetField.DefinedSize, "%" & Trim(Request(theFieldName)) & "%") End If End If set targetField = nothing Next For i = 0 to UBound(bFieldNameArray) theFieldName = bFieldNameArray(i) dbFieldName = bDbFieldArray(i) set targetField = sampleRecord.Fields(dbFieldName) If StringExists(Request(theFieldName)) Then qryString = qryString & " AND ([" & dbFieldName & "] = ?)" myCmd.Parameters.Append myCmd.CreateParameter(theFieldName, targetField.type, 1, targetField.DefinedSize, Request(theFieldName)) End If set targetField = nothing Next For i = 0 to UBound(sngFieldNameArray) theFieldName = sngFieldNameArray(i) dbFieldName = sngDbFieldArray(i) set targetField = sampleRecord.Fields(dbFieldName) If StringExists(Request(theFieldName)) Then qryString = qryString & " AND (? <= [" & dbFieldName & "]) AND ([" & dbFieldName & "] <= ?)" myCmd.Parameters.Append myCmd.CreateParameter(theFieldName & "1", targetField.type, 1, targetField.DefinedSize, (CSng(Request(theFieldName)) * (1 - sngToleranceArray(i)))) myCmd.Parameters.Append myCmd.CreateParameter(theFieldName & "2", targetField.type, 1, targetField.DefinedSize, (CSng(Request(theFieldName)) * (1 + sngToleranceArray(i)))) End If set targetField = nothing Next For i = 0 to UBound(lngFieldNameArray) theFieldName = lngFieldNameArray(i) dbFieldName = lngDbFieldArray(i) set targetField = sampleRecord.Fields(dbFieldName) If StringExists(Request(theFieldName)) Then qryString = qryString & " AND (? <= [" & dbFieldName & "]) AND ([" & dbFieldName & "] <= ?)" myCmd.Parameters.Append myCmd.CreateParameter(theFieldName & "1", targetField.type, 1, targetField.DefinedSize, (CLng(Request(theFieldName)) - lngToleranceArray(i))) myCmd.Parameters.Append myCmd.CreateParameter(theFieldName & "2", targetField.type, 1, targetField.DefinedSize, (CLng(Request(theFieldName)) + lngToleranceArray(i))) End If set targetField = nothing Next qryString = qryString & " ORDER BY [Building Name]" myCmd.CommandText = qryString myCmd.Prepared = True set RSSites = myCmd.Execute isQueryResult = True RecCount = 0 If Not(RSSites.BOF And RSSites.EOF) Then Do While Not(RSSites.EOF) RecCount = RecCount + 1 RSSites.MoveNext Loop RSSites.Requery End If Case "Retrieve" set RSSites = conn.execute("SELECT * FROM [Available Sites] WHERE [Id] = " & Request("Id")) isQueryResult = True If Not(RSSites.BOF And RSSites.EOF) Then RSSites.MoveFirst RecCount = 1 End If Case "QuickSearch" ' ... Quick Searches happen only to Single Precision Decimal fields. Get the field name and preferred tolerance, then ' ... place the search parameters into a SQL statement. dbField = "" dbFieldTolerance = 0 If fieldType = "" Then For i = 0 To UBound(sngFieldNameArray) If sngFieldNameArray(i) = Request("dataField") Then dbField = sngDbFieldArray(i) dbFieldTolerance = sngToleranceArray(i) End If Next If StringExists(Request("Param1")) Then testVal1 = CSng(Request("Param1")) Else testVal1 = 0 End If If StringExists(Request("Param2")) Then testVal2 = CSng(Request("Param2")) Else testVal2 = 0 End If End If set targetField = sampleRecord.Fields(dbField) Select Case Request("Compare") Case "Between" qryString = "SELECT * FROM [Available Sites] WHERE (? <= [" & dbField & "]) AND ([" & dbField & "] <= ?) ORDER BY [Building Name]" If testVal2 > testVal1 Then myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "1", targetField.type, 1, targetField.DefinedSize, testVal1) myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "2", targetField.type, 1, targetField.DefinedSize, testVal2) Else myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "1", targetField.type, 1, targetField.DefinedSize, testVal2) myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "2", targetField.type, 1, targetField.DefinedSize, testVal1) End If Case "Match" lowerParam = testVal1 * (1 - dbFieldTolerance) upperParam = testVal1 * (1 + dbFieldTolerance) qryString = "SELECT * FROM [Available Sites] WHERE (? <= [" & dbField & "]) AND ([" & dbField & "] <= ?) ORDER BY [Building Name]" myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "1", targetField.type, 1, targetField.DefinedSize, lowerParam) myCmd.Parameters.Append myCmd.CreateParameter(targetField.name & "2", targetField.type, 1, targetField.DefinedSize, upperParam) End Select myCmd.CommandText = qryString myCmd.Prepared = True set RSSites = myCmd.Execute isQueryResult = True RecCount = 0 If Not(RSSites.BOF And RSSites.EOF) Then Do While Not(RSSites.EOF) RecCount = RecCount + 1 RSSites.MoveNext Loop RSSites.Requery End If set targetField = nothing Case Else set RSSites = nothing isQueryResult = False RecCount = 0 End Select If RecCount < 2 Then ' ... Write page layout ' ... Be Ready to Handle Three Situations: ' ...... (a) Initial Visit -- isn't a query result, but the opening query screen ' ...... (b) A query returned no results ' ...... (c) Query results (either one result matched, or they picked from the list If isQueryResult = False Then ' Header for Fresh Query page %>

You may use this page to find an available commercial site which meets your criteria. Click on the following link to open a new window containing the rules this query page follows:
Instructions Page

Quick Search Page

<% Else If RecCount = 0 Then ' ... Header for failed query page %>

No Results Were Found For Your Query

No Available Commercial Sites were found which match the criteria you used for your search. Please click the following link to return to the search page you just submitted, where you can change the parameters you used:
Return to the Search Page

Alternatively, you may use one of the links below to load a fresh search page, where you may start over with a blank form:

New Search Page

<% GetOut Response.End Else If Request("Action") = "Retrieve" Then ' ... Header for when a property is chosen from a list %>

This Property is Currently Available

The property described below matches the criteria you used for your search. If you would like to review another matching property, then please click the following link to return to your list of matches:
Return to List of Properties

Alternatively, you may use one of the links below to load a fresh search page, where you may start over with a blank form:

New Search Page

<% Else ' ... Header for when only one property was found %>

One Property Found.

The property described below is the only property we currently have on record which matches the criteria you used for your search. If you would like to see more properties, please click the following link to return to the search page you just submitted; where you can change the parameters you used:
Return to the Search Page

Alternatively, you may use one of the links below to load a fresh search page, where you may start over with a blank form:

New Search Page

<% End If End If End If ' ... Query table with optional query results or existing query parameters If isQueryResult And (RecCount > 0) Then haveData = True Else haveData = False End If %>
<% If haveData Then If StringExists(RSSites("Photo")) Then %> <% End If End If %>
Building
<% If haveData Then %> <% End If %>
Date Prepared: <% If Not(IsNull(RSSites("Date Prepared"))) Then Response.Write FormatDateTime(RSSites("Date Prepared"),2) Else Response.Write("N/A") End If %>
Last Updated: <% If Not(IsNull(RSSites("Last Updated"))) Then Response.Write FormatDateTime(RSSites("Last Updated"),2) Else Response.Write("N/A") End If %>
> Name: <%= WriteCell(haveData, "BuildingName", "Building Name", 20) %>
> Address: <%= WriteCell(haveData, "Address", "Address", 20) %>
> City: <%= WriteCell(haveData, "City", "City", 20) %> <% If haveData Then Response.Write "" If StringExists(RSSites("City")) Then Response.Write ", " End If Response.Write RSSites("State") & " " & RSSites("ZIP") Response.Write "" End If %>
> Parcel Number: <%= WriteCell(haveData, "PID", "Parcel Number", 12) %>
> Zoning: <%= WriteCell(haveData, "Zoning", "Zoning", 12) %>
Contact
<% If haveData Then %> <% End If %> <% If haveData Then %> <% End If %>
> Name: <% If haveData Then Response.Write "" Response.Write RSSites("Contact Title") & " " Response.Write "" End If %> <%= WriteCell(haveData, "ContactName", "Contact Name", 20) %>
> Company: <%= WriteCell(haveData, "ContactCompany", "Contact Company", 20) %>
Address: <% If Not(IsNull(RSSites("Contact Street"))) Then Response.Write RSSites("Contact Street") Else Response.Write "N/A" End If %>
> City: <%= WriteCell(haveData, "ContactCity", "Contact City", 20) %> <% If haveData Then Response.Write "" If StringExists(RSSites("Contact City")) Then Response.Write ", " End IF Response.Write RSSites("Contact State") & " " & RSSites("Contact ZIP") Response.Write "" End If %>
Phone: <% If Not(IsNull(RSSites("Contact Phone"))) Then Response.Write RSSites("Contact Phone") Else Response.Write "N/A" End If %>
FAX: <% If Not(IsNull(RSSites("Contact FAX"))) Then Response.Write RSSites("Contact FAX") Else Response.Write "N/A" End If %>
E-Mail: <%= WriteCell(haveData, "ContactEMail", "Contact E-Mail", 20) %>
Miles To
> Commercial Airport: <%= WriteCell(haveData, "CommercialAirportMiles", "Commercial Airport Miles", 2) %>
> Major Highway: <%= WriteCell(haveData, "MajorHighwayMiles", "Major Highway Miles", 2) %>
> Major Port: <%= WriteCell(haveData, "MajorPortMiles", "Major Port Miles", 2) %>
> Rail Terminal: <%= WriteCell(haveData, "RailTerminalMiles", "Rail Terminal Miles", 2) %>
Site
<%= WriteRadio(haveData, "HighVisibility", "High Visibility") %> <%= WriteRadio(haveData, "EntZone", "Ent Zone") %> <%= WriteRadio(haveData, "RailAccessOnSite", "Rail Access On Site") %>
Yes No
> High Visibility:
> Enterprise Zone:
> Rail Access On Site:
> Site Size (Acres): <%= WriteCell(haveData, "SiteSizeAcres", "Site Size Acres", 4) %>
> Parking Spaces: <%= WriteCell(haveData, "ParkingSpaces", "Parking Spaces", 4) %>
Property
<%= WriteRadio(haveData, "InPark", "In Park") %> <%= WriteRadio(haveData, "MultiTenant", "Multi Tenant") %> <%= WriteRadio(haveData, "CanSubdivide", "Can Subdivide") %> <%= WriteRadio(haveData, "Lease", "Lease") %> <%= WriteRadio(haveData, "Purchase", "Purchase") %> <%= WriteRadio(haveData, "LeasePurchase", "Lease Purchase") %>
Yes No
> In Park:
> Multi-Tenant:
> Can Subdivide:
> Can Lease:
> Can Purchase:
> Lease/Purchase:
Utilities
> Sewer Provider: <%= WriteCell(haveData, "Sewer", "Sewer Provider", 20) %> > Water Provider: <%= WriteCell(haveData, "Water", "Water Provider", 20) %>
> Electric Provider: <%= WriteCell(haveData, "Electric", "Electric Provider", 20) %> > Natural Gas Provider: <%= WriteCell(haveData, "NatGas", "Natural Gas Provider", 20) %>
> Other Utilities: <%= WriteCell(haveData, "OtherUtil", "Other Utilities", 60) %>
Construction
<%= WriteRadio(haveData, "Sprinkler", "Sprinkler") %> <%= WriteRadio(haveData, "PlantAC", "Plant AC") %> <%= WriteRadio(haveData, "OfficeAC", "Office AC") %> <%= WriteRadio(haveData, "RaisedFloor", "Raised Floor") %>
   
> Year Built: <%= WriteCell(haveData, "YearBuilt", "Year Built", 4) %> Yes No
> Primary Material: <%= WriteSelect(haveData, "PrimaryMaterial", "Primary Material") %> > Sprinklers: > Eave Height (Ft): <%= WriteCell(haveData, "EaveHeightFt", "Eave Height Ft", 3) %>
> Primary Use: <%= WriteSelect(haveData, "PrimaryUse", "Primary Use") %> > Plant A/C: > Maximum Ceiling Height (Ft): <%= WriteCell(haveData, "MaxCeilingHeightFt", "Max Ceiling Height Ft", 3) %>
> Dock Truck Doors: <%= WriteCell(haveData, "DockTruckDoors", "Dock Truck Doors", 3) %> > Office A/C: > Number of Floors: <%= WriteCell(haveData, "NumberOfFloors", "Number Of Floors", 2) %>
> Floor Truck Doors: <%= WriteCell(haveData, "FloorTruckDoors", "Floor Truck Doors", 3) %> > Raised Floors: > Floor Thickness (In): <%= WriteCell(haveData, "FloorThicknessIn", "Floor Thickness In", 3) %>
Square Footage
   
width="33%"> Total: <%= WriteCell(haveData, "TotalSqFeet", "Total Sq Feet", 10) %> width="34%" rowspan="2"> Finished Office: <%= WriteCell(haveData, "FinishedOfcSqFt", "Finished Ofc Sq Ft", 10) %> width="33%"> Available Manufacturing: <%= WriteCell(haveData, "AvailMfgSqFt", "Avail Mfg Sq Ft", 10) %>
width="33%"> Available: <%= WriteCell(haveData, "AvailSqFeet", "Avail Sq Feet", 10) %> width="34%"> Available Warehouse: <%= WriteCell(haveData, "AvailWhseSqFt", "Avail Whse Sq Ft", 10) %>
Photo

" alt="Picture of <%= RSSites("Building Name") %>">

> Comments: <% if (haveData) then ' We cannot simply use the WriteCell procedure because "Comments" is a Memo field. ' ... Memo fields have to be handled separately. ' ... ... They have to be the last field in the recordset, ' ... ... and you can only retrieve their value once. qryString = "SELECT [Comments] FROM [Available Sites] WHERE ([Id] = " & RSSites("Id") & ")" set RSComments = conn.execute(qryString) set CommentText = RSComments("Comments") if StringExists("CommentText") then Response.Write(CommentText) else Response.Write("N/A") end if else Response.Write(WriteCell(haveData, "Comments", "Comments", 60)) end if %>
<% If Not(haveData) Then %>

<% End If %>
<% Else ' ... Make a list of matching records If Request("Format") = "ListAll" Then %>

List of All Available Commercial Properties On Record

The table below lists all the properties we currently have on record which are currently available for lease and/or purchase. You may view the details we have on file for any of these properties by clicking on the building name in the table below.

Alternatively, you may use one of the links below to load a search page, where you may use a set of known criteria to find a property which will meet your needs:

New Search Page

<% Else %>

These properties matched your query parameters.

The properties described below are the properties we currently have on record which match the criteria you used for your search. You may view the details we have on file for any of these properties by clicking on the building name in the table below.

If you are dissatisfied with these results, or would like to try a different set of search parameters, please click the following link to return to the search page you just submitted; where you can change the values you used for your search: Return to the Search Page

Alternatively, you may use one of the links below to load a fresh search page, where you may start over with a blank form:

New Search Page

<% End If %> <% Do Until RSSites.EOF %> <% RSSites.MoveNext Loop %>
Building Name Location
"> <%= RSSites("Building Name") %> <% ansString = "" If StringExists(RSSites("Address")) Then ansString = Trim(RSSites("Address")) End If If StringExists(RSSites("City")) Then If Len(ansString) > 0 Then ansString = ansString & ", " & Trim(RSSites("City")) Else ansString = Trim(RSSites("City")) End If End If If StringExists(RSSites("State")) Then If Len(ansString) > 0 Then ansString = ansString & ", " & Trim(RSSites("State")) Else ansString = Trim(RSSites("State")) End If End If If StringExists(RSSites("ZIP")) Then If Len(ansString) > 0 Then ansString = ansString & ", " & Trim(RSSites("ZIP")) Else ansString = Trim(RSSites("Zip")) End If End If Response.Write ansString %>
<% End If GetOut %> <% Private Sub GetOut() set sampleRecord = nothing set strFieldNameArray = nothing set strDbFieldArray = nothing set bFieldNameArray = nothing set bDbFieldArray = nothing set sngFieldNameArray = nothing set sngDbFieldArray = nothing set sngToleranceArray = nothing set lngFieldNameArray = nothing set lngDbFieldArray = nothing set lngToleranceArray = nothing set RSSites = nothing set myCmd = nothing conn.close set conn = nothing End Sub %>