Results 1 to 5 of 5

Thread: SQL select FROM...WHERE ....txtBox " " ' $ ????

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    17

    Question

    I am TRYING to understand this....

    Trying to write a SQL select statement that will
    pull data where the database field (Customer Name)
    equals the value that the user enters in a text box.
    I've seen examples, but I get lost in the strings of
    symbols ("'" & " '&").
    So, please correct this stament:

    "SELECT * FROM Sales WHERE (Customer Name = "txtBox.text")"

    Sales = database table
    Customer Name = table field
    txtBox = name of text box user inputs to

    THANKS.
    thanks, jackie

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    "SELECT * FROM Sales WHERE Customer Name = '" & trim(txtBox.text) & "'"

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    17
    Thanks for the quick reply.
    I used your example (cut & paste is great!!)
    and still get:

    Run-time error '3075'
    Syntax error (missing operator) in
    query expression 'Customer Name = 'Smith"

    I imagine the single quote preceeding the Customer
    and Smith (the text box data) and the double quote
    following Smith are significant...but it's lost on me.

    What am I doing wrong?
    I am using VB5.
    thanks, jackie

  4. #4
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    If you're using Access, then:

    "SELECT * FROM Sales WHERE [Customer Name] = '" & trim(txtBox.text) & "'"

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    17

    Smile

    THANK YOU THANK YOU THANK YOU.

    That worked! I knew it was a simple
    symbol issue. Thanks for sharing the
    knowledge so generously. This forum is
    priceless....and all of those who post
    solutions are saints!

    thanks, jackie

Posting Permissions

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



Click Here to Expand Forum to Full Width