Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Select WITH text1.text = ?????

Status
Not open for further replies.

zenenigma

Programmer
Apr 23, 2001
119
US
First of all, I have a VB program which looks up the items in a table. The field I would like to search on may have 5-10 records for each value. I would like the ability to display the records in a table where field1 = text1.text (in other words a value on my VB form which will require user input). I've tried the "Select * from table1 where field1 = text1.text" etc. I'm looking for a select statement I can put in the RecordSource of my data control. I've thought about just making an Access query, but it wouldn't be able to get the value of the filter. Any information would be appreciated. I hope the Keyword Search is back up soon, because I'm not sure if someone else has asked this
 
You need to append the textfield's value to the sql string like this:

"Select * from table1 where field1 = '" & text1.text & "'"

notice that the ticks (') are used if field1 is a text field, if it is an integer field or some other numeric field, leave out the ticks.

Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top