Full Version: query-search
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
leeegglestone
If i have a field in a database where both numbers and text will be entered
If i have a query setup to do a search, is it possible for a partial amount of text to be entered and still find records with a partial match and display them on screen, are there some symbols you can put in the criteria when creating the query
e.g if i have a name egglestone in the table
can i put egg and it would bring everything to me??
R. Hicks
Use the following example for the criteria for the text field:
CODE
Like [Forms]![YourFormName]![ControlName] & "*"

Where "YourFormName" is the name of the form being referenced ...
And "ControlName" is the name of the control on the form being referenced ...

RDH
leeegglestone
i am confused, am i supposed to be putting that information above into the criteria section when designing the query?

Why would i have to put a form name in, when it was direct through a query.
I tried what i understood to mean

Like [Forms]![rc-plitbl]![RC/PLI] & ""

RC/PLI is the field in rc-plitbl i want to search, when run i got a box asking for parameter value, tried things but then i just get empty records returned to me
R. Hicks
If you have the query prompting for the value ... use:
CODE
Like [Enter Value to Search] & "*"

"Enter Value to Search" should be your prompt text ...

RDH
leeegglestone
yes i got it to work this time.
In testing, i have lee egglestone stored in this field so if i entered the complete name the records containing this were displayed but if i just put egg in the prompt I get nothing back.

I thought this would allow me to type a partial match to whats stored in that field?
R. Hicks
To return a value in the middle of the text .. you need:
CODE
Like "*" & [Enter Value to Search] & "*"

RDH
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.