W
WebDude
i'm back.
I have a table "SocialWorkerTable" with a field "fkRequestID" that is linked
to the primary key field "pkRequestID" in the table "Requests". The
relationship is such that, every record in the "SocialWorkerTable" must have
*one and only one* record in the "Requests" table. And, every record in the
"Requests" table can have several related records in the "SocialWorkerTable"
table.
Using the query window/grid, I wrote a simple "QueryA" which displays
records from the "Requests" and this field...
SWName: (SELECT [SocialWorkerName] FROM SocialWorkerTable WHERE
SocialWorkerTable.Date = (SELECT Max(T.Date) FROM SocialWorkerTable As T
WHERE T.[fkRequestID] = SocialWorkerTable.[fkRequestID] AND
Requests.pkRequestID = SocialWorkerTable.fkRequestID))
However, if a "Request" record listed in "QueryA" does not have a related
record in the SocialWorkerTable, then "QueryA" returns no results and i get
the following error on my subquery..."At most one record can be returned by
this SubQuery"
Can i tweak my subquery to take into consideration that there may not be a
related record in the the "SocialWorkerTable" and to please return a zero
length empty string instead of bombing?
Any help, links, pointers or examples, would be appreciated
Cheers,
WebDude 2006
ps: i tried adding nz(), IIF() and IsNull to the subquery, but perhaps i
didnt put them in the right spot?
I have a table "SocialWorkerTable" with a field "fkRequestID" that is linked
to the primary key field "pkRequestID" in the table "Requests". The
relationship is such that, every record in the "SocialWorkerTable" must have
*one and only one* record in the "Requests" table. And, every record in the
"Requests" table can have several related records in the "SocialWorkerTable"
table.
Using the query window/grid, I wrote a simple "QueryA" which displays
records from the "Requests" and this field...
SWName: (SELECT [SocialWorkerName] FROM SocialWorkerTable WHERE
SocialWorkerTable.Date = (SELECT Max(T.Date) FROM SocialWorkerTable As T
WHERE T.[fkRequestID] = SocialWorkerTable.[fkRequestID] AND
Requests.pkRequestID = SocialWorkerTable.fkRequestID))
However, if a "Request" record listed in "QueryA" does not have a related
record in the SocialWorkerTable, then "QueryA" returns no results and i get
the following error on my subquery..."At most one record can be returned by
this SubQuery"
Can i tweak my subquery to take into consideration that there may not be a
related record in the the "SocialWorkerTable" and to please return a zero
length empty string instead of bombing?
Any help, links, pointers or examples, would be appreciated
Cheers,
WebDude 2006
ps: i tried adding nz(), IIF() and IsNull to the subquery, but perhaps i
didnt put them in the right spot?