how to allow the user to enter their search criteria

N

No1momof3

HI
I have wached the video showing me how the user of the DB can enter their
own dates to perform a query but I need to know how the user of my database
can enter for example their own "Country" or "insitution" so that they can
find for example - all students who have went to "Japan" or "Kyoto
University".

My columns are headed "Country" and "institution" - i tried for example
"=[Country]" it worked the first time and allowed the user to enter the
country but then it stopped and didn't give a search option at all - clicking
on the query just brough up al the records.
 
J

Jackie L

Create a form with unbound fields for Country and Institution. Then create a
query which refers to those fields as its criteria. For example, for the
field country, in the criteria you could have:

Like "*" & [Forms]![frmNewForm]![Country] &"*"

On the after update event of the unbound field, or on a button on your form,
you could have the code to open the query or a report based off your query.

If you want a range of data create unbound fields BegCountry and EndCountry
on your form. Then the criteria string in the query would be:

Between [Forms]![frmNewForm]![BegCountry] and
[Forms]![frmNewForm]![EndCountry]

Hope this helps
 
B

Bob Barrows

No1momof3 said:
HI
I have wached the video showing me how the user of the DB can enter
their own dates to perform a query but I need to know how the user of
my database can enter for example their own "Country" or "insitution"
so that they can find for example - all students who have went to
"Japan" or "Kyoto University".

My columns are headed "Country" and "institution" - i tried for
example "=[Country]" it worked the first time and allowed the user to
enter the country but then it stopped and didn't give a search option
at all - clicking on the query just brough up al the records.

I'm surprised it worked the first time. This can only work when the
parameter name is different from any of the objects in the query's
scope. In this case, you said "=[Country]" ... well, "Country" is the
name of a field in your table, so Access has no reason to prompt for a
value. If you had said this instead it would have worked:
=[Enter country name]
 

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