Queries with selection from a FormField

J

John Bruen

I have a query where the criteria is coming from a form,
ie: FORMS!FRMSELECT!MySelect. If I put a single value in
the field - "A" (with out quotes), it works fine. When I
put ="A" or "B" in the field, no data is returned from the
query. Is there any way to put multiple values in the
criteria coming from a form field?
 
J

John Vinson

I have a query where the criteria is coming from a form,
ie: FORMS!FRMSELECT!MySelect. If I put a single value in
the field - "A" (with out quotes), it works fine. When I
put ="A" or "B" in the field, no data is returned from the
query. Is there any way to put multiple values in the
criteria coming from a form field?

Not easily. A parameter in a Query can contain only values to be
searched, and cannot contain operators such as OR.

What you'll need to do is write VBA code to poll through the controls
on FRMSELECT and build up a valid SQL string. If you're using free
textboxes and letting the user type in any arbitrary SQL code, you
need to be certain that the users have a solid understanding of SQL
syntax!
 

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