I get a syntax error when the page initially loads. Search form and asp handler all on the same page (provDir.asp). My If Then statements are supposed to only use their contained code if the message respective form field isn't empty. The error is pointing to the "If" in the first If then statement. Any help would be great. Thanks!
Here's the form:
Here's the asp:
Here's the form:
Code:
<form name="srchProv" method="post" action="provDir.asp">
<tr>
<td>Last Name:</td>
<td><input type="text" name="LastName" value="" /></td>
</tr>
<tr>
<td>City:</td>
<td><input type="text" name="city" value="" /></td>
</tr>
<tr>
<td>Specialty:</td>
<td><input type="text" name="specialty" value="" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" name="submitit" value="Search Providers" /></td>
</tr>
</form>
Code:
' FORM Variables
sLname = Request.QueryString("LastName")
sCity = Request.QueryString("city")
sSpecialty = Request.QueryString("specialty")
sSQLStatement = "SELECT LastName, FirstName, License, [practice name] AS Practice_Name, Address, City, State, Zip, Specialty, Phone, County FROM [Provider 2006] WHERE State IS NOT NULL"
If sLname <> "''" Then
sSQLStatement = sSQLStatement & " AND LastName LIKE '%" & sLname & "%'" & _
End If
If sCity <> "''" Then
sSQLStatement = sSQLStatement & " AND LastName LIKE '%" & sLname & "%'" & _
End If
If sSpecialty <> "''" Then
sSQLStatement = sSQLStatement & " AND LastName LIKE '%" & sLname & "%'"
End If