A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Report Query Difficulties



 
 
Thread Tools Display Modes
  #1  
Old September 22nd, 2009, 07:16 PM posted to microsoft.public.access.queries
RayToddJr
external usenet poster
 
Posts: 17
Default Report Query Difficulties

I have a query for a report. This this query, I have a sub-query. I think I
have pinpointed my overall problem to the sub-query.

The SQL for the sub-query is listed below.

The Problem:

The purpose of the sub-query is to get the concatenated name of the property
owners and the first address. It should not contain multiple rows.

I have attempted adding the DISTINCT and the DISTINCTROW clauses to no
avail, if there is more than one owner, I still get a row for each owner with
and the associated address for that owner.

SQL for the sub-query:

SELECT taPROPERTY.PropertyID, taPROPERTY.CLT, Trim(CONCATENATE("SELECT
tadefendantnames.FirstName & ' ' & MiddleName & ' ' & LastName & ' ' &
Suffix FROM taDEFENDANTNAMES INNER JOIN taDefendants ON
taDEFENDANTNAMES.DefendantsnameID=taDEFENDANTS.Def endantsnameID WHERE
tadefendants.PropertyID=" & [taPROPERTY].[PropertyID] & " AND
tadefendants.DefendantTypeID=20")) AS Property_Owner,
taDEFENDANTNAMES.Address1 AS OwnerAddress1, taDEFENDANTNAMES.Address2 AS
OwnerAddress2, taDEFENDANTNAMES.City AS OwnerCity, taDEFENDANTNAMES.State AS
OwnerState, taDEFENDANTNAMES.Zip AS OwnerZip
FROM taPROPERTY INNER JOIN (taDEFENDANTNAMES INNER JOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID = taDEFENDANTS.DefendantsNameID) ON
taPROPERTY.PropertyID = taDEFENDANTS.PropertyID
WHERE (((taDEFENDANTS.DefendantTypeID)=20));


In case it is needed, here is SQL for the main query:

SELECT DISTINCT taPROPERTY.PropertyID, taPROPERTY.CLT,
taTAXSALESTATUS.TaxSaleStatus, taCOURTDATA.TaxSaleNumber,
taPROPERTY.ParcelNumber, taPROPERTY.PropertyAddress,
taDEEDDESCRIPTION.DeedDescription, taCOURTDATA.CaseYear, [CaseYear]-1 AS
CaseYearOlder, [qryExhibitA4-Owner].Property_Owner,
[qryExhibitA4-Owner].OwnerAddress1, [qryExhibitA4-Owner].OwnerAddress2,
[qryExhibitA4-Owner].OwnerCity, [qryExhibitA4-Owner].OwnerState,
[qryExhibitA4-Owner].OwnerZip
FROM (taTAXSALESTATUS INNER JOIN ((taCOURTDATA INNER JOIN taPROPERTY ON
taCOURTDATA.CourtDataID = taPROPERTY.CourtDataID) LEFT JOIN taDEEDDESCRIPTION
ON taPROPERTY.PropertyID = taDEEDDESCRIPTION.PropertyID) ON
taTAXSALESTATUS.TaxSaleStatusID = taPROPERTY.TaxSaleStatusID) INNER JOIN
[qryExhibitA4-Owner] ON taPROPERTY.PropertyID =
[qryExhibitA4-Owner].PropertyID;

Thanks for any help and suggestions that can be made.

Ray.

  #2  
Old September 22nd, 2009, 07:51 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Report Query Difficulties

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

I have a query for a report. This this query, I have a sub-query. I think I
have pinpointed my overall problem to the sub-query.

The SQL for the sub-query is listed below.

The Problem:

The purpose of the sub-query is to get the concatenated name of the property
owners and the first address. It should not contain multiple rows.

I have attempted adding the DISTINCT and the DISTINCTROW clauses to no
avail, if there is more than one owner, I still get a row for each owner with
and the associated address for that owner.

SQL for the sub-query:

SELECT taPROPERTY.PropertyID, taPROPERTY.CLT, Trim(CONCATENATE("SELECT
tadefendantnames.FirstName & ' ' & MiddleName & ' ' & LastName & ' ' &
Suffix FROM taDEFENDANTNAMES INNER JOIN taDefendants ON
taDEFENDANTNAMES.DefendantsnameID=taDEFENDANTS.Def endantsnameID WHERE
tadefendants.PropertyID=" & [taPROPERTY].[PropertyID] & " AND
tadefendants.DefendantTypeID=20")) AS Property_Owner,
taDEFENDANTNAMES.Address1 AS OwnerAddress1, taDEFENDANTNAMES.Address2 AS
OwnerAddress2, taDEFENDANTNAMES.City AS OwnerCity, taDEFENDANTNAMES.State AS
OwnerState, taDEFENDANTNAMES.Zip AS OwnerZip
FROM taPROPERTY INNER JOIN (taDEFENDANTNAMES INNER JOIN taDEFENDANTS ON
taDEFENDANTNAMES.DefendantsNameID = taDEFENDANTS.DefendantsNameID) ON
taPROPERTY.PropertyID = taDEFENDANTS.PropertyID
WHERE (((taDEFENDANTS.DefendantTypeID)=20));


In case it is needed, here is SQL for the main query:

SELECT DISTINCT taPROPERTY.PropertyID, taPROPERTY.CLT,
taTAXSALESTATUS.TaxSaleStatus, taCOURTDATA.TaxSaleNumber,
taPROPERTY.ParcelNumber, taPROPERTY.PropertyAddress,
taDEEDDESCRIPTION.DeedDescription, taCOURTDATA.CaseYear, [CaseYear]-1 AS
CaseYearOlder, [qryExhibitA4-Owner].Property_Owner,
[qryExhibitA4-Owner].OwnerAddress1, [qryExhibitA4-Owner].OwnerAddress2,
[qryExhibitA4-Owner].OwnerCity, [qryExhibitA4-Owner].OwnerState,
[qryExhibitA4-Owner].OwnerZip
FROM (taTAXSALESTATUS INNER JOIN ((taCOURTDATA INNER JOIN taPROPERTY ON
taCOURTDATA.CourtDataID = taPROPERTY.CourtDataID) LEFT JOIN taDEEDDESCRIPTION
ON taPROPERTY.PropertyID = taDEEDDESCRIPTION.PropertyID) ON
taTAXSALESTATUS.TaxSaleStatusID = taPROPERTY.TaxSaleStatusID) INNER JOIN
[qryExhibitA4-Owner] ON taPROPERTY.PropertyID =
[qryExhibitA4-Owner].PropertyID;

Thanks for any help and suggestions that can be made.

Ray.

  #3  
Old September 22nd, 2009, 08:35 PM posted to microsoft.public.access.queries
RayToddJr
external usenet poster
 
Posts: 17
Default Report Query Difficulties

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.

Thanks,

Ray.

"Duane Hookom" wrote:

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP


  #4  
Old September 22nd, 2009, 08:55 PM posted to microsoft.public.access.queries
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Report Query Difficulties

On Tue, 22 Sep 2009 12:35:02 -0700, RayToddJr
wrote:

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.


Since you're trying to display data at two levels of aggregation in the
Report, I'd suggest using a Query which retrieves the "finest" level - leins;
and using the Report's Sorting and Grouping feature to get the breakdown.
Group By the PropertyID, and put the property specific information in a Group
Header (and/or Footer); put the lein-specific information in the Detail
section of the report.
--

John W. Vinson [MVP]
  #5  
Old September 22nd, 2009, 10:23 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Report Query Difficulties

Does the address information depend on the Property or owner? If multiple
owners have multiple addresses, how would you want this to display?

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.

Thanks,

Ray.

"Duane Hookom" wrote:

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP


  #6  
Old September 23rd, 2009, 06:29 PM posted to microsoft.public.access.queries
RayToddJr
external usenet poster
 
Posts: 17
Default Report Query Difficulties

the address information is dependant on the owner.

If there are multiple owners, we want to use the address of the first owner
entered into the database.

"Duane Hookom" wrote:

Does the address information depend on the Property or owner? If multiple
owners have multiple addresses, how would you want this to display?

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.

Thanks,

Ray.

"Duane Hookom" wrote:

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP


  #7  
Old September 23rd, 2009, 08:11 PM posted to microsoft.public.access.queries
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Report Query Difficulties

Do you have a method for identifying the "address of the first owner entered
into the database"? If you do, you haven't told us.

Please try to pull together all of your specifications so someone can help.

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

the address information is dependant on the owner.

If there are multiple owners, we want to use the address of the first owner
entered into the database.

"Duane Hookom" wrote:

Does the address information depend on the Property or owner? If multiple
owners have multiple addresses, how would you want this to display?

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.

Thanks,

Ray.

"Duane Hookom" wrote:

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP

  #8  
Old September 24th, 2009, 05:45 PM posted to microsoft.public.access.queries
RayToddJr
external usenet poster
 
Posts: 17
Default Report Query Difficulties

Duane:

I will do a better job next time of getting the specifications written down
before posting. Thanks for your help.

Ray.

"Duane Hookom" wrote:

Do you have a method for identifying the "address of the first owner entered
into the database"? If you do, you haven't told us.

Please try to pull together all of your specifications so someone can help.

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

the address information is dependant on the owner.

If there are multiple owners, we want to use the address of the first owner
entered into the database.

"Duane Hookom" wrote:

Does the address information depend on the Property or owner? If multiple
owners have multiple addresses, how would you want this to display?

--
Duane Hookom
Microsoft Access MVP


"RayToddJr" wrote:

Hello Duane and thanks for your assistance:

The report that is being created is a faily straight forward report.

1. It list the propertyID, CLT, The Concatenated Property Owner Name and the
first address that is listed for an owner (if there is more than one owner).

2. Further down in the report, a list of all of the liens that were found
in on the property (which can be numerous).

What I have found is that when a property has more than one owner, the
report will list the liens the same number of times of owners, i.e., if we
have 1 lien and 5 owners, this same lien will be listed 5 times in the detail
section of the report.

In my trying to find out the cause of this, I think that I have traced it to
this sub-query. However, I'm no expert and could be completely wrong and
looking in the wrong direction.

Any further guidance would be appreciated.

Thanks,

Ray.

"Duane Hookom" wrote:

If you don't want a record for every defendant, you need to remove a level of
detail records from the main query or apply a GROUP BY on the main query.

--
Duane Hookom
Microsoft Access MVP

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:36 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.