Link to home
Start Free TrialLog in
Avatar of freethinker23
freethinker23

asked on

Error using a wildcard in a SQL search

I have a text box that takes input from a user and I want to use that information to do a SQL search.  I am searching on last name and I would like them to be able to do a partial search.

My current SQL statement is:
SELECT DISTINCT str_agent_number, str_agent_fname, str_agent_lname, num_agent_code, str_location_code, num_mbc_code, num_territory_number, str_address, str_city, str_zip, str_phone_number, str_state FROM tbl_sro_boatdeck INNER JOIN tbl_state_code_lookup ON tbl_sro_boatdeck.num_state_code = tbl_state_code_lookup.num_state_code WHERE tbl_sro_boatdeck.str_agent_lname LIKE '" & txtLName.Text & "'"

When I put a % sign on either side of 'txtLName.Text' I receive an invalid character error.  Please advise.  thanks.
ASKER CERTIFIED SOLUTION
Avatar of Torrwin
Torrwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of freethinker23
freethinker23

ASKER

That worked, thanks