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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL String

Status
Not open for further replies.

FoxStudent

Technical User
Feb 24, 2000
85
GB
I am building an SQL string to select records based on what the user enters in a textbox. I am using a line of code such as: sWhere = sWhere & " AND s.CommonName = " & txtCommonName
If for example txtCommonName contains: Tall Fescue it thinks that Tall Fescue is a paramater rather than the string I want to search for. How can I solve this problem!

thank u

Grainne










 
You must use single quotes around text criteria:

sWhere = sWhere & " AND s.CommonName = '" & txtCommonName
& "'"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top