Search problem

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

I have a form based on a query that is used as a prompt for parameters on a
number of controls. I am using the Like function in my query. I am also
suggesting the users use an * as a wildcard so if they want to find all
words which include "reg" they input *reg* However there are occasions when
they may want to search for "EC" (we are in the UK and this is an
abbreviation for European Community) however if they use EC we get every
record which includes ec in that control eg words like "directive",
"elective" etc How can I use the like function with wild cards to just look
for "EC" Hope this makes sense!

TIA
Tony Williams
 
Thi behavior is because of the Like.
You would need to give them a choice of how to search, such as a frame with
radio buttons, where one button would give fuzzy search and the other
exact..
Then you would have to build a query string where the criteria format would
be dependent on the setting of the radio buttons. For For exact search you
would have something like ....WHERE MyTable.MyField = ' " & Me.txtSpec & "
' ......
Not the saces between the ' nd the ", this will enclose the criteria in you
query with blanks , e.g. ' EC '.

Ragnar
 
Thanks Ragnar I think I follow that. So I need 2 queries and which one is
used depends on which radio button is selected? However does this only work
if the control data is exactly EC? I want to find all records where the data
contains the initials EC so one record may have "EC Directive" and another
record may have "EC Response" The users will input "EC" to find both
records.
Will your suggestion work for that?
Thanks
Tony
 
Back
Top