On Sun, 31 Oct 2004 01:05:56 -0000, "John" <Jo**@nospam.infovis.co.uk>
wrote:
Simply concatenate the entire sql statement. For example in the
Report_Open event of your report you can write:
Me.RecordSource = "select * from mytable where mytable.myfield in (" &
[Forms]![myform]![myfield] & ")"
Note that I'm concatenating 3 substrings to create the RecordSource.
The IN-clause requires comma-separated values, for example:
2,3
So that's what you would enter in your field.
Note that this is not legal SQL:
select * from mytable where mytable.myfield = 2 or 3
This should be:
select * from mytable where mytable.myfield=2 or mytable.myfield=3
Note that if you have text rather than numbers, quotes may be needed.
For example your field would contain:
'aaa','bbb'
and a sql statement with OR would read:
select * from mytable where mytable.myfield='aaa' or
mytable.myfield='bbb'
-Tom.
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