Report query problem

J

John

Hi

I have a report with an underlying query. The criteria is coming from a
field on the form which calls the report. So the query is 'select * from
mytable where mytable.myfield = [Forms]![myform]![myfield]'. The problem is
that the form field doe snot contain a single value like x but 'x or y'.
This does not work in a query if the form field has this value. How do I get
the report to work with two or more values connected by an 'or' operator?

Thanks

Regards
 
M

MacDermott

The criteria would have to read more like
WHERE mytable.myfield="x" OR mytable.myfield="y"
As you can see, it would take a good deal of parsing to get this out of "x
or y".

As an alternative, you might consider giving your users a multiselect list
box, where they could select the items they want included.
From there, you can build a WHERE condition in the form of
WHERE mytable.myfield IN("x","y")
You can include this condition (without the WHERE ) in the DoCmd.OpenReport
command.

HTH
- Turtle
 
Top