|
-
Sep 12th, 2000, 04:20 PM
#1
Thread Starter
Junior Member
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.
-
Sep 12th, 2000, 04:29 PM
#2
Frenzied Member
"SELECT * FROM Sales WHERE Customer Name = '" & trim(txtBox.text) & "'"
-
Sep 12th, 2000, 04:41 PM
#3
Thread Starter
Junior Member
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.
-
Sep 12th, 2000, 05:19 PM
#4
Frenzied Member
If you're using Access, then:
"SELECT * FROM Sales WHERE [Customer Name] = '" & trim(txtBox.text) & "'"
-
Sep 13th, 2000, 08:30 AM
#5
Thread Starter
Junior Member
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!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|