Query by Form Keyword problem

D

David Lane

Hi

I am using a Form to enter a Keyword or string in to a Query. The Query
selects those records where a Keyword is found in a Memo Field. This
works well but I have to manually enter the wild card * as the first and
last character of the Keyword, ie *Keyword*

This works well but is tedious. Is there a way of adding the two
wildcard characters automatically? Perhaps similar to the "Find" button
on the toolbar.
Many thanks

David
Weymouth UK
 
M

MGFoster

David said:
Hi

I am using a Form to enter a Keyword or string in to a Query. The Query
selects those records where a Keyword is found in a Memo Field. This
works well but I have to manually enter the wild card * as the first and
last character of the Keyword, ie *Keyword*

This works well but is tedious. Is there a way of adding the two
wildcard characters automatically? Perhaps similar to the "Find" button
on the toolbar.
Many thanks

Set up your query's WHERE clause like this:

WHERE column_name LIKE "*" & Forms!FormName!ControlName & "*"
 
D

David Lane

Hi MG Foster

Many thanks for the answer.

I had to add square brackets to get it to work (as per my old manual)
but all is well now.
The final expression is now:-

Like "*" & [Forms]![Keyword Input]![Keyword 1] & "*"

I had already tried a similar expression but had not noticed their
should be spaces before and after the ampersands (&).

Thanks again

David


The message <[email protected]>
Set up your query's WHERE clause like this:
WHERE column_name LIKE "*" & Forms!FormName!ControlName & "*"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top