D
dchendrickson
I am using Access2002/XP.
I need some guidence regarding syntax for a subquery that
is refering to a calculated field for its WHERE statement.
At the end of my query I would like to look up a few
items and concatenate them into a label. The values for
this concatenated label come from a couple of differnt
tables (all shown in the query window). I tried to create
one large SQL subquery to do this, but ended up breaking
it into parts to debug.
I have a calculated field that returns an ID number from
a table - an integer. The calculated field is a simple
subquery and it works correctly.
ConnectsCID: (SELECT p.IOCardConnector FROM tblIOCardPin
AS p WHERE p.IOCardPinID = tblIOCardPin!PinConnectsTo)
The 'p' alias is used since this subquery calls back upon
its own table for the value. This returns the ID of a
particular connector.
The next calculated field is to return the Label for that
connector. That information is in a different table and
looks like:
ConnectsCLabel: (SELECT ConnectorLabel FROM
tblIOCardConnector AS c WHERE c!IOCardConnectorID =
ConnectsCID)
This is the subquery causing problems - When I run the
query it asks me to enter the parameter value for
ConnectsCID. So the value is not being pulled from the
first calculated field into this one. If I enter what I
know is the proper value, the subquery returns the
correct information (entered either by typing into the
parameter dialog box or replacing the reference to ...CID
with the same value hardcoded in). If I eliminate all the
subquery text leaving only:
ConnectsCLabel: ConnectsCID
the value of ...CID is returned in the ...Label
calculated field. So in this case the value is being
pulled in.
What in the SELECT... statement causes the call to the
first calculated field to grenade?
Thanks for your time and for sharing your knowledge.
-dc
I need some guidence regarding syntax for a subquery that
is refering to a calculated field for its WHERE statement.
At the end of my query I would like to look up a few
items and concatenate them into a label. The values for
this concatenated label come from a couple of differnt
tables (all shown in the query window). I tried to create
one large SQL subquery to do this, but ended up breaking
it into parts to debug.
I have a calculated field that returns an ID number from
a table - an integer. The calculated field is a simple
subquery and it works correctly.
ConnectsCID: (SELECT p.IOCardConnector FROM tblIOCardPin
AS p WHERE p.IOCardPinID = tblIOCardPin!PinConnectsTo)
The 'p' alias is used since this subquery calls back upon
its own table for the value. This returns the ID of a
particular connector.
The next calculated field is to return the Label for that
connector. That information is in a different table and
looks like:
ConnectsCLabel: (SELECT ConnectorLabel FROM
tblIOCardConnector AS c WHERE c!IOCardConnectorID =
ConnectsCID)
This is the subquery causing problems - When I run the
query it asks me to enter the parameter value for
ConnectsCID. So the value is not being pulled from the
first calculated field into this one. If I enter what I
know is the proper value, the subquery returns the
correct information (entered either by typing into the
parameter dialog box or replacing the reference to ...CID
with the same value hardcoded in). If I eliminate all the
subquery text leaving only:
ConnectsCLabel: ConnectsCID
the value of ...CID is returned in the ...Label
calculated field. So in this case the value is being
pulled in.
What in the SELECT... statement causes the call to the
first calculated field to grenade?
Thanks for your time and for sharing your knowledge.
-dc