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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Exclude an ID from a Group



 
 
Thread Tools Display Modes
  #1  
Old February 10th, 2010, 07:50 PM posted to microsoft.public.access
Chuck W[_2_]
external usenet poster
 
Posts: 98
Default Exclude an ID from a Group

Hi,
I have a table called tblPhysician with the fields PhysID, PhysName and
Speciality. There are about 1000 Physician and and about 12 Specialties.
There is also a table tblMedRecords that has PhysID and Mortality Counts for
2009. The field Mortality can have a count of zero or 1. I created a report
that sums the Mortality by Physician. What I want to do is to add another
field to report that sums Mortality by the specialty but excludes the
physician. I want my data to look like this:

PhysID PhysName Mortality Specialty SpecialtyMort
100 Jones 3 Cardiology 20
200 Smith 2 Cardiology 19

For Physician 100 I want to get a sum of all Mortalities for all
Cardilogists except him and call this SpecialtyMort (the 20 Cardiology
mortalities would exclude his 3). For Physician 200 I want to get again
exclude his mortalities and get all other Cardiologies including Phys 100.

Can someone help?

Thanks,
Chuck
  #2  
Old February 11th, 2010, 06:44 AM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default Exclude an ID from a Group

Try these --
qrySpecCount --
SELECT tblPhysician.Speciality, Sum(tblMedRecords.Mortality) AS SumOfMortality
FROM tblPhysician INNER JOIN tblMedRecords ON tblPhysician.PhysID =
tblMedRecords.PhysID
GROUP BY tblPhysician.Speciality;

SELECT tblPhysician.PhysID, tblPhysician.PhysName, tblMedRecords.Mortality,
tblPhysician.Speciality, [SumOfMortality]-[Mortality] AS SpecialtyMort
FROM (tblPhysician INNER JOIN tblMedRecords ON tblPhysician.PhysID =
tblMedRecords.PhysID) INNER JOIN qrySpecCount ON tblPhysician.Speciality =
qrySpecCount.Speciality;

--
Build a little, test a little.


"Chuck W" wrote:

Hi,
I have a table called tblPhysician with the fields PhysID, PhysName and
Speciality. There are about 1000 Physician and and about 12 Specialties.
There is also a table tblMedRecords that has PhysID and Mortality Counts for
2009. The field Mortality can have a count of zero or 1. I created a report
that sums the Mortality by Physician. What I want to do is to add another
field to report that sums Mortality by the specialty but excludes the
physician. I want my data to look like this:

PhysID PhysName Mortality Specialty SpecialtyMort
100 Jones 3 Cardiology 20
200 Smith 2 Cardiology 19

For Physician 100 I want to get a sum of all Mortalities for all
Cardilogists except him and call this SpecialtyMort (the 20 Cardiology
mortalities would exclude his 3). For Physician 200 I want to get again
exclude his mortalities and get all other Cardiologies including Phys 100.

Can someone help?

Thanks,
Chuck

  #3  
Old February 11th, 2010, 01:23 PM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default Exclude an ID from a Group

Chuck:

You can do this in the report by grouping the report on Specialty and giving
it a speciality group footer. As you are summing the mortality figures
already I'd guess the report is already grouped on Speciality and then on
Physician. In the speciality footer add a text box with a ControlSource of:

=Sum([Mortality])

Name the text box txtSpecialityMortalityTotal. You can set the text box's
Visible property to False (No) to hide it if you wish, or if you don't want
the footer to show at all set the group footer section's Visible property to
False.

In the header or footer section where you are currently summing the mortality
figures per physician add the SpecialtyMort text box and give it a
ControlSource property of:

= [txtSpecialityMortalityTotal] – Sum([Mortality])

That will subtract the current physician's total mortality figure for the
speciality from the overall total mortality figure for the speciality.

Ken Sheridan
Stafford, England

Chuck W wrote:
Hi,
I have a table called tblPhysician with the fields PhysID, PhysName and
Speciality. There are about 1000 Physician and and about 12 Specialties.
There is also a table tblMedRecords that has PhysID and Mortality Counts for
2009. The field Mortality can have a count of zero or 1. I created a report
that sums the Mortality by Physician. What I want to do is to add another
field to report that sums Mortality by the specialty but excludes the
physician. I want my data to look like this:

PhysID PhysName Mortality Specialty SpecialtyMort
100 Jones 3 Cardiology 20
200 Smith 2 Cardiology 19

For Physician 100 I want to get a sum of all Mortalities for all
Cardilogists except him and call this SpecialtyMort (the 20 Cardiology
mortalities would exclude his 3). For Physician 200 I want to get again
exclude his mortalities and get all other Cardiologies including Phys 100.

Can someone help?

Thanks,
Chuck


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201002/1

 




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 04:19 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.