Each of the following recordsets work as intended when used individually, however, I would like to switch between the two based on if Request.QueryString("PostalCode")has or does not have a value. I'm not sure if the proper code would include the IsNull or IsEmpy but when tried either one (see code that follows), the app reads the second recordset as if there is a value for Request.QueryString("PostalCode") even when there really is no value for it.
If IsNull(Request.QueryString("PostalCode")) Then
Recordset1.Source = "SELECT SoldToCMAccountNo, ID, DocStatus, CustomText10, CustomText07, CustomText08, ShipToCompany, ShipToContact, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToPostalCode, ShipToCountry, ShipToPhone, ShipToPhoneExt, DocID, ManufacturerPartNumber, prodfamid_fam, ZIP_CODE, LATITUDE, LONGITUDE, STATE FROM Query1 ORDER BY DocID DESC"
Else
Recordset1.Source = "SELECT SoldToCMAccountNo, ID, DocStatus, CustomText10, CustomText07, CustomText08, ShipToCompany, ShipToContact, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToPostalCode, ShipToCountry, ShipToPhone, ShipToPhoneExt, DocID, ManufacturerPartNumber, prodfamid_fam, ZIP_CODE, LATITUDE, LONGITUDE, STATE FROM Query1 WHERE LATITUDE <= " + Replace(Recordset1__HighLatitude, "'", "''") + " AND latitude >= " + Replace(Recordset1__LowLatitude, "'", "''") + " AND longitude >= " + Replace(Recordset1__LowLongitude, "'", "''") + " AND longitude <= " + Replace(Recordset1__HighLongitude, "'", "''") + " ORDER BY DocID DESC"
End If
If IsNull(Request.QueryString("PostalCode")) Then
Recordset1.Source = "SELECT SoldToCMAccountNo, ID, DocStatus, CustomText10, CustomText07, CustomText08, ShipToCompany, ShipToContact, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToPostalCode, ShipToCountry, ShipToPhone, ShipToPhoneExt, DocID, ManufacturerPartNumber, prodfamid_fam, ZIP_CODE, LATITUDE, LONGITUDE, STATE FROM Query1 ORDER BY DocID DESC"
Else
Recordset1.Source = "SELECT SoldToCMAccountNo, ID, DocStatus, CustomText10, CustomText07, CustomText08, ShipToCompany, ShipToContact, ShipToAddress1, ShipToAddress2, ShipToCity, ShipToState, ShipToPostalCode, ShipToCountry, ShipToPhone, ShipToPhoneExt, DocID, ManufacturerPartNumber, prodfamid_fam, ZIP_CODE, LATITUDE, LONGITUDE, STATE FROM Query1 WHERE LATITUDE <= " + Replace(Recordset1__HighLatitude, "'", "''") + " AND latitude >= " + Replace(Recordset1__LowLatitude, "'", "''") + " AND longitude >= " + Replace(Recordset1__LowLongitude, "'", "''") + " AND longitude <= " + Replace(Recordset1__HighLongitude, "'", "''") + " ORDER BY DocID DESC"
End If