syntax error (missing operator) query expression

Ask a Question related to ASP, Design and Development.

  1. #1

    Default syntax error (missing operator) query expression

    valuA = (request.form("toadd"))
    If valuA = "" then
    SQL = "UPDATE CourseReg SET attended='Active' WHERE ID
    IN("&request.form("toadd")&")"
    Set RS = MyConn.Execute(SQL)

    End If
    MyConn.Close
    Set RS = Nothing
    Set MyConn = Nothing
    the error
    syntax error (missing operator) query expression ID IN ()
    alexz Guest

  2. Similar Questions and Discussions

    1. [microsoft][odbc microsoft access driver] syntax error (missing operator) in query expression error
      I have a query I want to run using DBQwiksite siftware, which produces the syntax error (missing operator) in query expression error when...
    2. Syntax error (missing operator) in query expression
      Hi, I have received the following error: ODBC Error Code = 37000 (Syntax error or access violation) Syntax error (missing operator) in query...
    3. Access: (missing operator) in query expression
      Hi! I operate a database where visitors do inputs directly from the web thru a form. One field has the datatype (property?) Memo and I have not...
    4. Syntax error in Query Expression,
      Hi everyone I have a page on my site in which i wish to display links to brochures, and i have stored an index of these links in my database. ...
    5. Syntax error (missing operator) in query expression'idProperty='
      The following is the code, can someone please help me with the syntax please in the first line please Conn.Execute "UPDATE tblRentalProperty SET...
  3. #2

    Default Re: syntax error (missing operator) query expression

    MyConn.Open "media"
    If (Request("toadd") = "") then
    SQL = "UPDATE CourseReg SET attended='' WHERE ID
    IN("&request.form("toadd")&")"
    RESPONSE.WRITE SQL
    RESPONSE.END
    Set RS = MyConn.Execute(SQL)

    That what i get
    UPDATE CourseReg SET attended='' WHERE ID IN()

    if i remove the if statement, i get
    UPDATE CourseReg SET attended='' WHERE ID IN(237)

    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Alex zurab Guest

  4. #3

    Default Re: syntax error (missing operator) query expression

    > If (Request("toadd") = "") then
    > SQL = "UPDATE CourseReg SET attended='' WHERE ID
    > IN("&request.form("toadd")&")"
    Think about this. You're saying, "if this value is blank, put blank into
    the IN clause."


    Aaron Bertrand - MVP Guest

  5. #4

    Default Re: syntax error (missing operator) query expression

    1. Why would you want to execute if toadd IS equal to ""? Wouldn't you
    only want to do it if toadd IS NOT equal to ""?

    2. You're using request("toadd") and request.form("toadd"). Perhaps you
    have a querystring that isn't helping things.

    3. Create a variable named sToAdd or something and use sToAdd =
    Request.Form("toadd"). Then use the variable instead of constantly calling
    the value from the form and/or ruquest collection.

    Ray at home

    "Alex zurab" <anonymous@devdex.com> wrote in message
    news:eDKpo59RDHA.1804@TK2MSFTNGP11.phx.gbl...
    > MyConn.Open "media"
    > If (Request("toadd") = "") then
    > SQL = "UPDATE CourseReg SET attended='' WHERE ID
    > IN("&request.form("toadd")&")"
    > RESPONSE.WRITE SQL
    > RESPONSE.END
    > Set RS = MyConn.Execute(SQL)
    >
    > That what i get
    > UPDATE CourseReg SET attended='' WHERE ID IN()
    >
    > if i remove the if statement, i get
    > UPDATE CourseReg SET attended='' WHERE ID IN(237)
    >
    > *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    > Don't just participate in USENET...get rewarded for it!

    Ray at Guest

  6. #5

    Default Re: syntax error (missing operator) query expression


    I tried using variable before and it didn't help.
    the reason i want to execute if toadd IS equal to ""
    is that the checkbox is already checked if there is a value (i.e it's
    been update).
    if i uncheck and resubmit i want that field to be null again
    so a user can fix the record if it was sumbmitted by mistake (not my
    idea but i have boses that want certain things).

    This is how i did it.
    Response.Write("<form action='add.asp' method=Post>")
    if rs("attended") = "Active" then
    Response.Write ("<input type=checkbox name=toadd value="""& rs("id")&"""
    CHECKED>")
    else
    Response.Write ("<input type=checkbox name=toadd value="""&
    rs("id")&""">")
    End if


    *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
    Don't just participate in USENET...get rewarded for it!
    Alex zurab Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139