I am trying to use a like statement with no success. Here is what I am doing:
Dim ObjRS
Dim StrSQL
Dim varLocation
varLocation = Request.Form("location"
Set objRS = Server.CreateObject("ADODB.Recordset"
StrSQL = "SELECT LOCATION, REGION1, SITE_CATEGORY, SITE_CATEGORY_2 FROM "
StrSQL = StrSQL & "REGION WHERE LOCATION LIKE ('" & varLocation & "*')"
I can write this query to the screen - copy and paste it into access and it works great and it does return records. If I remove the LIKE statement in the WHERE clause and replace with LOCATION = ('" & varLocation & "')" it will work as long as varLocation has a exact match in the database? I need for the user to be able to enter a "location"/mailstop. A complete mailstop is 10 characters(FLTBAC0101). If the user enters FLTB I need the recordset to return all values like FLTB(Florida, Tampa Bay), if the user enters FL, I need the recordset to return all mailstops in FL(Florida). What I am I doing wrong?
Dim ObjRS
Dim StrSQL
Dim varLocation
varLocation = Request.Form("location"
Set objRS = Server.CreateObject("ADODB.Recordset"
StrSQL = "SELECT LOCATION, REGION1, SITE_CATEGORY, SITE_CATEGORY_2 FROM "
StrSQL = StrSQL & "REGION WHERE LOCATION LIKE ('" & varLocation & "*')"
I can write this query to the screen - copy and paste it into access and it works great and it does return records. If I remove the LIKE statement in the WHERE clause and replace with LOCATION = ('" & varLocation & "')" it will work as long as varLocation has a exact match in the database? I need for the user to be able to enter a "location"/mailstop. A complete mailstop is 10 characters(FLTBAC0101). If the user enters FLTB I need the recordset to return all values like FLTB(Florida, Tampa Bay), if the user enters FL, I need the recordset to return all mailstops in FL(Florida). What I am I doing wrong?