A
Andre C
I have a query linked to a form wher the person can select criteria
and the result is repesented as a report. All works fine.
The problem is how do I add a single line to the report which
calculates the percentage the query represents of the whole? I have a
suspicion the solution lies in DSUM but maybe I am wrong.
To clarify:
The database records all nurse contacts with patients. each patient
has their allocated nurse, doctor and disease.
The query at its basic level collects data from several tables. the
aim being to generate a list of all visits. The form then asks the
user to filter based around doctor or nurse or even month and year and
disease.
SO, foir instance the user can ask the form "show me all visits by
nurse Sarah of patients with disease computeritis for 2005." In VBA I
generate the filter thus
strFilter = "[CCN-ID] " & strCCN & _
" AND [consultantID] " & strconsultant & _
" AND [visitID] " & strvisitID & _
" AND [DiseaseID] " & strdisease & _
" And [visitmonth] " & strvisitmonth & _
" And [visityear] " & strvisityear & _
" And [Active] " & strcaseload
If SysCmd(acSysCmdGetObjectState, acReport, strReport) <>
acObjStateOpen Then
DoCmd.OpenReport strReport, acViewPreview
End If
' Apply the filter and switch it on
With Reports(strReport)
.Filter = strFilter
.FilterOn = True
End With
This works fine. It does what it says on the box.
But what I want is to be able to say at the bottom of the report is
the percentage of visits by nurse Sarah of patients with disease
computeritis for 2005 of all visits for nurse Sarah of patients for
2005. Of course the query no longer has that data as it has been
filtered in the VBA.
I thiught of creating another query, identical and filtering it minus
the disease-code. But I could not udnerstand how to sum the result and
add it to the report. I thought about subreports but again could not
get my mind around it.
The trouble is that both parts of the percentage are variables
dependin gon what the user sleelcts. i.e the user and potentially
select from the query form the following:
visits of nurse Sarah and nurse Jane of patients with disease
computeritis and nerditis for March 2005. It is very dynamic and so I
guessx the percentage figure will be dynamic.
Any ideas.
Andre
and the result is repesented as a report. All works fine.
The problem is how do I add a single line to the report which
calculates the percentage the query represents of the whole? I have a
suspicion the solution lies in DSUM but maybe I am wrong.
To clarify:
The database records all nurse contacts with patients. each patient
has their allocated nurse, doctor and disease.
The query at its basic level collects data from several tables. the
aim being to generate a list of all visits. The form then asks the
user to filter based around doctor or nurse or even month and year and
disease.
SO, foir instance the user can ask the form "show me all visits by
nurse Sarah of patients with disease computeritis for 2005." In VBA I
generate the filter thus
strFilter = "[CCN-ID] " & strCCN & _
" AND [consultantID] " & strconsultant & _
" AND [visitID] " & strvisitID & _
" AND [DiseaseID] " & strdisease & _
" And [visitmonth] " & strvisitmonth & _
" And [visityear] " & strvisityear & _
" And [Active] " & strcaseload
If SysCmd(acSysCmdGetObjectState, acReport, strReport) <>
acObjStateOpen Then
DoCmd.OpenReport strReport, acViewPreview
End If
' Apply the filter and switch it on
With Reports(strReport)
.Filter = strFilter
.FilterOn = True
End With
This works fine. It does what it says on the box.
But what I want is to be able to say at the bottom of the report is
the percentage of visits by nurse Sarah of patients with disease
computeritis for 2005 of all visits for nurse Sarah of patients for
2005. Of course the query no longer has that data as it has been
filtered in the VBA.
I thiught of creating another query, identical and filtering it minus
the disease-code. But I could not udnerstand how to sum the result and
add it to the report. I thought about subreports but again could not
get my mind around it.
The trouble is that both parts of the percentage are variables
dependin gon what the user sleelcts. i.e the user and potentially
select from the query form the following:
visits of nurse Sarah and nurse Jane of patients with disease
computeritis and nerditis for March 2005. It is very dynamic and so I
guessx the percentage figure will be dynamic.
Any ideas.
Andre