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

SQL Code taking user input from text box not working

Status
Not open for further replies.

KaayJaay

IS-IT--Management
Jul 6, 2004
64
US
I am using SQL that takes input from the user through a text box, and pops out a report. Here is the code:

SELECT *
FROM Tech_Info
WHERE (((Tech_Info.[Tech#]) Like "[Forms]![Find Tech]![Tech#]*"));

But, This code doesnt return anything. Im trying to make it so that everything that the user enters it looks for something similiar to make it easy on the user. Any Suggestions?

KaayJaay
 
I don't think you can reference the control with wildcard characters like that...

what you are infact doing is casting the reference to a string, so you are looking for tech# which have a value of "[Forms]![Find Tech]![Tech#]*" which is obviously wrong...

you need to do something like:
WHERE (((instr(1,Tech_Info.[Tech#],[Forms]![Find Tech]![Tech#], vbtextcompare)));
 
Have you tried something like this ?
WHERE Tech_Info.[Tech#]) Like [Forms]![Find Tech]![Tech#] & '*';



Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top