I am using checkboxes to build a string value that
([Forms]![C28FILES_DOCTR]![LocationFilter]) will use. Here is what I have
so far.
PARAMETERS [Forms]![C28FILES_DOCTR]![LocationFilter] Text ( 255 );
TRANSFORM Sum(AllCharges.BalDue) AS SumOfBalDue
SELECT AllCharges.FinClass, Sum(AllCharges.BalDue) AS [Total Of BalDue]
FROM AllCharges
WHERE (((AllCharges.DB) In ([Forms]![C28FILES_DOCTR]![LocationFilter])))
GROUP BY AllCharges.FinClass
ORDER BY AllCharges.FinClass
PIVOT AllCharges.DB;
If I only pass one value, for example C28, in
In([Forms]![C28FILES_DOCTR]![LocationFilter])
then it works fine. However, if I put C28,C47 it returns no results. I
have tried to add the In statement in the
PARAMETERS [Forms]![C28FILES_DOCTR]![LocationFilter] Text ( 255 );
but it makes this
PARAMETERS [In[Forms]![C28FILES_DOCTR]![LocationFilter] Text ( 255 )];
and tells me invalid bracketing. If I manuall type in two values like
this
WHERE (((AllCharges.DB) In (C28,C47) it works fine. All I want to do is
be
able to pass in the In() from another form. Is this not possible?
Michel Walsh said:
So, if field1 has the value "C28, C47", you need to keep a record if
field2 IN("C28", "C47") ?
Can then use
field1 LIKE "*" & field2 & "*"
(note the position of field1 and field2 are not usual, somehow)
or, if you want to be safe, adding delimiters:
(" " & field1 & "," ) LIKE ( "*[, ]" & field2 & "[, ]*" )
Vanderghast, Access MVP
Ryan said:
I need an IN statement, not a Like Or.
--
Please remember to mark this post as answered if this solves your
problem.
:
It is more likely to be the operator LIKE
WHERE fieldName LIKE "*C28*" OR fieldName LIKE "*C47*"
As it is, right now, if the field have the value "C28, C29"
the record will be picked up, but it will also be picked up with
"TC28,
C29" though.
Vanderghast, Access MVP
Is it possible to use the text value in a field on a form to be the
in()
part
of a query. For example, if the field had C28, C47 could the query
say
In(C28,C47)?