Have the query read the name from the text box on a form.
For example, the Criteria in the query might read:
Like "*" & [Forms].[Form1].][Text0] & "*"
If you already have the name in the form you are working with, you could
use:
=DCount("*", "Table1", "[Surname] Like ""*" & [Text0] & "*""")
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
<ChasW> wrote in message
news:pp********************************@4ax.com...
Greetings,
I have a form that uses a query as its record source. In the form I
have a text box that uses this as its control source:
=DCount("[ID]", "qry_Search_by_Name")
The DCount function works properly with the query until I add a
criteria to the query like this:
Like "*" & [enter name] & "*"
then the DCount returns #Error
How can I make DCount work when the query uses a criteria this way?
Thank you in advance!
Chas