search form not working properly

G

Guest

I have a search form that has one text box that is input procedure into a
query.
using query expression :

Like "* " & [Forms]![test]![keywordsearch] & "*"

That works.
I have the query run on searchform opening and a requery button to re run
the search with the user defined values (using a requery action macro)

I tried to add another two boxes and have it so the results returned depend
on which box the search request was typed into ie if only the year text box
is filled in then return anything with matching value (year is a 4 digit
number - not a date field) or if in the description box then search through
records in the description field and if the keyword box then the keyword
field.

What happened was it seems to return virtually all records regardless of
which box i enter my request in.

I used the same expression but changed the name of the appropriate text box
to match the box it's supposed to read from fr searching that field.

Have tried both "and" and "or" with similar results.

I have tried running the query directly to see if it is the form at fault or
the query and still get similar results.

Unsure if this is a query issue, form issue or both.

Thans.
 
K

Keith Wilby

Krazy Darcy said:
I have a search form that has one text box that is input procedure into a
query.
using query expression :

Like "* " & [Forms]![test]![keywordsearch] & "*"

That works.
I have the query run on searchform opening and a requery button to re run
the search with the user defined values (using a requery action macro)

I tried to add another two boxes and have it so the results returned
depend
on which box the search request was typed into ie if only the year text
box
is filled in then return anything with matching value (year is a 4 digit
number - not a date field) or if in the description box then search
through
records in the description field and if the keyword box then the keyword
field.

What happened was it seems to return virtually all records regardless of
which box i enter my request in.

I used the same expression but changed the name of the appropriate text
box
to match the box it's supposed to read from fr searching that field.

Have tried both "and" and "or" with similar results.

I have tried running the query directly to see if it is the form at fault
or
the query and still get similar results.

Unsure if this is a query issue, form issue or both.

Thans.

This is the wrong group for this kind of question but I would suggest that
it's a wildcard issue - your query string will contain "Like **" for those
text boxes left blank. Have you considered using "filter by form"?

Keith.
www.keithwilby.com
 

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