Duane and Douglas:
I updated the sql as indicated below. Duane, I did add the reference to the
PropertyID in the taPROPERTY table in the where statement.
Despite these changes (both with and without the reference to the
taPROPERTY.PropertyID field), I am now getting the following error:
Run-Time Error: 3061
Too Few Parameters. Expected 1.
SELECT DISTINCT taPROPERTY.PropertyID, Concatentate("SELECT FirstName & ' '
& MiddleName & ' ' & LastName & ' ' & Suffix FROM taDEFENDANTS where
PropertyID=" & taPROPERTY.[PropertyID] & " AND DefendantType=""Owner""") AS
Property_Owner
FROM taPROPERTY INNER JOIN (taDEFENDANTTYPE INNER JOIN taDEFENDANTS ON
taDEFENDANTTYPE.DefendantTypeID = taDEFENDANTS.DefendantTypeID) ON
taPROPERTY.PropertyID = taDEFENDANTS.PropertyID;
Thanks,
Ray
Duane Hookom said:
I would probably use:
SELECT DISTINCT taDEFENDANTS.PropertyID, Concatentate("SELECT FirstName & '
' & MiddleName & ' ' & LastName & ' ' & Suffix FROM taDEFENDANTS where
PropertyID=" & [PropertyID] & " AND DefendantType='Owner'") AS
Property_Owner
FROM taDEFENDANTTYPE INNER JOIN taDEFENDANTS ON
taDEFENDANTTYPE.DefendantTypeID = taDEFENDANTS.DefendantTypeID;
Don't you have a table with unique PropertyID values rather than using
taDEFENDANTS in both the Concatenate() and the main query?
--
Duane Hookom
Microsoft Access MVP
:
Not only that, but the SQL being passed to the function doesn't look valid
(it's missing an AND in the Where clause)
SELECT DISTINCT taDEFENDANTS.PropertyID, Concatentate("SELECT FirstName & '
' & MiddleName & ' ' & LastName & ' ' & Suffix FROM taDEFENDANTS where
PropertyID=" & [PropertyID] & " AND DefendantType=""Owner""") AS
Property_Owner
FROM taDEFENDANTTYPE INNER JOIN taDEFENDANTS ON
taDEFENDANTTYPE.DefendantTypeID = taDEFENDANTS.DefendantTypeID;
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
What's "Concatentate"? There's no built-in function with that name.
If it's a user defined function, you need to see what it's does. I should
be
in a module.
One way to find out is to do a Ctrl + g to bring up the VBA window.
Next do a F2 to bring up the Object Browser.
Put Concatentate in the search window and see what if finds.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.
:
The following statement creates the following Run-Time Error:
Run-Time Error 3075:
Syntax error (missing operator) in query expression 'PropertyID=2
DefendantType="Owner"
SELECT DISTINCT taDEFENDANTS.PropertyID, Concatentate("SELECT FirstName &
'
' & MiddleName & ' ' & LastName & ' ' & Suffix FROM taDEFENDANTS where
PropertyID=" & [PropertyID] & " DefendantType=""Owner""") AS
Property_Owner
FROM taDEFENDANTTYPE INNER JOIN taDEFENDANTS ON
taDEFENDANTTYPE.DefendantTypeID = taDEFENDANTS.DefendantTypeID;
Please Help...
Thanks,
Ray.