#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    17
    Rep Power
    0

    Microsoft VBScript compilation (0x800A0401) Expected end of statement


    Hi,

    I have a dropdownlist and from that ddl if I choose one of the fields

    and submit, all of that fields data come out. Like search filter.

    My code is as follow but I dont know why I got above error.

    Please, can anyone advice me. Thanks in advanced.

    Artistic_Fields = Trim(Request("Artistic_Fields"))

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Film") = #" & Artistic_Fields & "#) " [highlight]////// The error is show up here end of line before " (double code)
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Literary_Arts") = #" & Artistic_Fields & "#) "
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Dance") = #" & Artistic_Fields & "#) "
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Music") = #" & Artistic_Fields & "#) "
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Theatre") = #" & Artistic_Fields & "#) "
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Visual_Arts") = #" & Artistic_Fields & "#) "
    End If

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND (rs("Artistic_Field_Others") = #" & Artistic_Fields & "#) "
    End If


    <td>
    <b>Artistic Field(s): </b>
    <select name="Artistic_Fields" size="1" width="60" class="formfield">
    <option>- All Fields -</option>
    <option value="Film" <% If Artistic_Fields = "Film" Then Response.Write "selected" %>>Film</option>
    <option value="Literary Arts" <% If Artistic_Fields = "Literary Arts" Then Response.Write "selected" %>>Literary Arts</option>
    <option value="Dance" <% If Artistic_Fields = "Dance" Then Response.Write "selected" %>>Dance</option>
    <option value="Music" <% If Artistic_Fields = "Music" Then Response.Write "selected" %>>Music</option>
    <option value="Theatre" <% If Artistic_Fields = "Theatre" Then Response.Write "selected" %>>Theatre</option>
    <option value="Visual Arts" <% If Artistic_Fields = "Visual Arts" Then Response.Write "selected" %>>Visual Arts</option>
    <option value="Others" <% If Artistic_Fields = "Others" Then Response.Write "selected" %>>Others</option>
    </select>
    </td>
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2012
    Posts
    103
    Rep Power
    9
    you are trying just concatinate sql string, rs("Artistic_Field_Film") is value from database, I do not knoe from where you get rs("Artistic_Field_Film"), but if it is database value code

    Code:
    If IsFields(Artistic_Fields) Then
     sql = sql & "AND (rs("Artistic_Field_Film") = #" & Artistic_Fields & "#) " [highlight]////// The error is show up here end of line before " (double code)
     End If
    should be changed to

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND " & (rs("Artistic_Field_Film") & " = #" & Artistic_Fields & "#) "
    End If
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    17
    Rep Power
    0

    Expected ')' Microsoft VBScript compilation


    Hi,

    I used the exact same code like you said but

    show up the Expected ')' error on the following line.

    If IsFields(Artistic_Fields) Then
    sql = sql & "AND" &(rs("Artistic_Field_Film")& " = #" Artistic_Fields & "#) " /////Error show up this line before (&)
    End If

    Please, can anyone suggest more to fix this code.

    Thanks.

IMN logo majestic logo threadwatch logo seochat tools logo