G
Guest
Context:
Access 2003, MDB file
Setup:
I have a query defined (schematically) as "SubqueryA LEFT JOIN SubqueryB".
The query returns some rows from SubqueryA that have no match in SubqueryB.
My question is about the way SubqueryB fields are handled when there is no
match to a row in Subquery A. In that situation: (a) text and numeric and
date fields in SubqueryB appear as Null in the result, which is expected; but
(b) a calculated field in SubqueryB that returns a date (using a user-defined
function) appears as #Error rather than Null.
Reaction:
I am surprised by this and want to know why Access works this way. I would
have thought that, when a row in SubqueryA is unmatched in SubqueryB, Access
would not inspect the innards of SubqueryB at all, and so would never notice
that a user-defined function is invoked. Obviously that expectation is wrong.
Question:
Can I change this query, or SubqueryB, in such a way as to avoid the #Error
for unmatched rows? I assume I can work around this by converting SubqueryB
into a MakeTable query instead of a SELECT query, but that takes longer.
Also, I want there to be a more elegant solution.
Thanks,
Wesley
P.S. I think nothing is added by furnishing the (complicated) SQL. I hope
the point is clear.
Access 2003, MDB file
Setup:
I have a query defined (schematically) as "SubqueryA LEFT JOIN SubqueryB".
The query returns some rows from SubqueryA that have no match in SubqueryB.
My question is about the way SubqueryB fields are handled when there is no
match to a row in Subquery A. In that situation: (a) text and numeric and
date fields in SubqueryB appear as Null in the result, which is expected; but
(b) a calculated field in SubqueryB that returns a date (using a user-defined
function) appears as #Error rather than Null.
Reaction:
I am surprised by this and want to know why Access works this way. I would
have thought that, when a row in SubqueryA is unmatched in SubqueryB, Access
would not inspect the innards of SubqueryB at all, and so would never notice
that a user-defined function is invoked. Obviously that expectation is wrong.
Question:
Can I change this query, or SubqueryB, in such a way as to avoid the #Error
for unmatched rows? I assume I can work around this by converting SubqueryB
into a MakeTable query instead of a SELECT query, but that takes longer.
Also, I want there to be a more elegant solution.
Thanks,
Wesley
P.S. I think nothing is added by furnishing the (complicated) SQL. I hope
the point is clear.