Hi Liz,
Not meaning to complicate things, but...
In situations like this in the past, I have used
a "Google model." I place 2 command buttons
on the form..
1) "I Feel Lucky"
- this would use the WHERE clause Mr. Spencer suggests.
2) "Match On Any"
- in VBA you would construct an "OR" WHERE clause
using *only* the search values that are "not blank."
On occasion, I have added a text box that DCount's number
of records that would be returned by the stored "AND" query
given the current entries in your search boxes. This can be an
easy way to give your users immediate feedback.
The point being that your user might not remember how to
spell "Murphy", or it was mistakenly entered as "Murphey"
in the memo field, etc.
The user types in "pleading" in first search box and tabs to
the second search box. The DCount textbox gets updated
to show say "325."
The user types in "Murphy" and tabs to the third search
box. The DCount textbox gets updated to zero. What's
going on?
The user then types in "45800", the DCount textbox will
still say zero, but can click on the "Match On Any" to scan
through results to see there is a record with "Murphey."
Again, I don't mean to complicate things, but every time
I read this thread, I kept feeling it should at least be suggested.
Good luck,
Gary Walter
John Spencer (MVP) said:
John,
Wouldn't leaving ANY one of the items blank return ALL records if you are using
OR? If you use AND then I think your solution would work to find records with
all designated strings.
MemoField Like ...
AND
MemoField Like ...
John said:
How can I construct a parameter query, or other kind of
query that will allow the user to type in multiple terms
in one parameter box?
As Cheval says, you can't. What you *can* do is arbitrarily limit the
user to (say) ten terms, in ten form textboxes; and use a criterion
like
[memofield] LIKE "*" & [Forms]![yourform]![term1] & "*"
OR
[memofield] LIKE "*" & [Forms]![yourform]![term2] & "*"
OR
[memofield] LIKE "*" & [Forms]![yourform]![term3] & "*"
OR
[memofield] LIKE "*" & [Forms]![yourform]![term4] & "*"
OR
<etc>
If the user leaves a term blank it will still work (returning all
records in the database if they leave all ten blank).