Prompting several different criteria from a form (Query by Form)

G

Guest

I'm trying to prompt several different criteria from a form (Query by Form)
and one or more of the criteria I may want to blank. I am currently using
[Forms]![formname]![controlname] in my query and a List Box on my form to
enter the criteria for the query. Do i need to add an expression in the query
or build a macro?
Byron
 
R

Rick B

Not sure what problem you're having with this, you look to be on the right
track.

I think that you may be having trouble getting the desired results when you
leave one of the fields blank?

If so, change your statement to:

=[Forms]![formname]![controlname] & Like "*"

or similar.

Also, if you are using several criteria for several fields, make sure you
watch the "and" and "or" conditions. Placing all the criteria on the same
row at the bottom of the criteria grid means that each item must match.
Since you are including "blank for all" conditions, this is most likely what
you want to do.

Hope that helps,
 
G

Guest

Thank you very much Rick B, you're solution didn't work but it pointed me in
the right direction by re-writing it to:
Like "*" & [Forms]![formname]![controlname]
Thanks again!

Rick B said:
Not sure what problem you're having with this, you look to be on the right
track.

I think that you may be having trouble getting the desired results when you
leave one of the fields blank?

If so, change your statement to:

=[Forms]![formname]![controlname] & Like "*"

or similar.

Also, if you are using several criteria for several fields, make sure you
watch the "and" and "or" conditions. Placing all the criteria on the same
row at the bottom of the criteria grid means that each item must match.
Since you are including "blank for all" conditions, this is most likely what
you want to do.

Hope that helps,

--
Rick B



Byron said:
I'm trying to prompt several different criteria from a form (Query by
Form)
and one or more of the criteria I may want to blank. I am currently using
[Forms]![formname]![controlname] in my query and a List Box on my form to
enter the criteria for the query. Do i need to add an expression in the
query
or build a macro?
Byron
 

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