D
-dch
I am running Access2002 under Windows XP Pro.
I have built a query as a row source for a listbox on a
form. The first version of the query is working fine.
My application requires an optional query for the same
listbox that is only slightly different. I simply
copied/pasted the working query and then attempted to
edit the copy.
These queries have an Expression that returns a value
from a subquery.
In the query version that works, my subquery WHERE
statement refers to one of the query table fields. That
statement looks something like:
....WHERE IOCardPinID = [PinMatesTo]
In the non-working query, I need to replace the
[PinMatesTo] with a reference to another Expression. But
when I do this, the query does not work. If I replace the
reference to the Expression with a hard-coded text
string, the subquery works as intended. I can reference
the same Expression into a new expression and it works
just fine as long as the new expression is not a subquery.
When I say the query does not work, what is happening is
when I run the query, I am asked to input a value for the
expression I am trying to reference - like a parameter
query.
Expression #1:
J1Label: ...returns a string.... ex. "CH0", "CH1"
Expression #2 (does not work - wants value for [J1Label])
J2Label: (SELECT...FROM...WHERE CardLabel=[J1Label]
Expression #2 (this works)
J2Label: (SELECT...FROM...WHERE CardLabel="CH0"
Expression #new (this works fine too)
Exp_New: left([J1Label],2)
How do I reference an Expression in my query into a
subquery inside another expression?
Thanks,
-dch
I have built a query as a row source for a listbox on a
form. The first version of the query is working fine.
My application requires an optional query for the same
listbox that is only slightly different. I simply
copied/pasted the working query and then attempted to
edit the copy.
These queries have an Expression that returns a value
from a subquery.
In the query version that works, my subquery WHERE
statement refers to one of the query table fields. That
statement looks something like:
....WHERE IOCardPinID = [PinMatesTo]
In the non-working query, I need to replace the
[PinMatesTo] with a reference to another Expression. But
when I do this, the query does not work. If I replace the
reference to the Expression with a hard-coded text
string, the subquery works as intended. I can reference
the same Expression into a new expression and it works
just fine as long as the new expression is not a subquery.
When I say the query does not work, what is happening is
when I run the query, I am asked to input a value for the
expression I am trying to reference - like a parameter
query.
Expression #1:
J1Label: ...returns a string.... ex. "CH0", "CH1"
Expression #2 (does not work - wants value for [J1Label])
J2Label: (SELECT...FROM...WHERE CardLabel=[J1Label]
Expression #2 (this works)
J2Label: (SELECT...FROM...WHERE CardLabel="CH0"
Expression #new (this works fine too)
Exp_New: left([J1Label],2)
How do I reference an Expression in my query into a
subquery inside another expression?
Thanks,
-dch