D
Dennis
I have a query form that has three query criteria fields.
The first field is a diagnoses, the second is the first
unit and the third is the second unit. First unit and
second unit is a Between [Beginning Unit] And [Ending
Unit] criteria. The diagnoses is the selected diagnoses in
the diagnoses field.
This query form works perfectly but I would like to print
out the results. I have another query form that only has a
one-selection criteria and I can print a report linking
the one-selection criteria to the report and it prints the
same data on a report as is on the query form. The
following is the code that does this:
Private Sub Print_Diagnoses_Button_Click()
On Error GoTo Err_Print_Diagnoses_Button_Click
Dim stDocName As String
stDocName = "DIAGNOSES Report"
stLinkCriteria = "[DIAGNOSES]='" & Me!cboDiagnoses
& "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_Print_Diagnoses_Button_Click:
Exit Sub
Err_Print_Diagnoses_Button_Click:
MsgBox Err.Description
Resume Exit_Print_Diagnoses_Button_Click
End Sub
What I want to do is the same thing but I need to have the
three criteria link to the report I have tried the
following to no avail:
Private Sub Print_Diagnoses_Report_Click()
On Error GoTo Err_Print_Diagnoses_Report_Click
Dim stDocName As String
stDocName = "DIAGNOSES By Unit"
stLinkCriteria = "[DIAGNOSES]='" & Me!cboDiagnoses
& "'"
stLinkCriteria = "Between [UNIT]='" & Me!cboUnitFirst
& "'"
stLinkCriteria = "And [UNIT]='" & Me!cboUnitLast & "'"
DoCmd.OpenReport stDocName, acPreview
Exit_Print_Diagnoses_Report_Click:
Exit Sub
Err_Print_Diagnoses_Report_Click:
MsgBox Err.Description
Resume Exit_Print_Diagnoses_Report_Click
End Sub
I have also tried many other attemps to no avail. Why
doesn't this work and how can I get it to work?
Included below is the code to the report query just in
case it is needed:
SELECT PATIENTS.CDC_NBR, PATIENTS.LNAME, PATIENTS.UNIT,
DIAGNOSES.DIAGNOSES, DIAGNOSES.Doctor,
DIAGNOSES.TypeOfTest, DIAGNOSES.[Test Results], *
FROM (PATIENTS LEFT JOIN DIAGNOSES ON PATIENTS.CDC_NBR =
DIAGNOSES.[CDC#]) LEFT JOIN [Schedule Details] ON
DIAGNOSES.DATE = [Schedule Details].ScheduleDate
ORDER BY PATIENTS.UNIT, DIAGNOSES.DIAGNOSES;
Thanks
Dennis
The first field is a diagnoses, the second is the first
unit and the third is the second unit. First unit and
second unit is a Between [Beginning Unit] And [Ending
Unit] criteria. The diagnoses is the selected diagnoses in
the diagnoses field.
This query form works perfectly but I would like to print
out the results. I have another query form that only has a
one-selection criteria and I can print a report linking
the one-selection criteria to the report and it prints the
same data on a report as is on the query form. The
following is the code that does this:
Private Sub Print_Diagnoses_Button_Click()
On Error GoTo Err_Print_Diagnoses_Button_Click
Dim stDocName As String
stDocName = "DIAGNOSES Report"
stLinkCriteria = "[DIAGNOSES]='" & Me!cboDiagnoses
& "'"
DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
Exit_Print_Diagnoses_Button_Click:
Exit Sub
Err_Print_Diagnoses_Button_Click:
MsgBox Err.Description
Resume Exit_Print_Diagnoses_Button_Click
End Sub
What I want to do is the same thing but I need to have the
three criteria link to the report I have tried the
following to no avail:
Private Sub Print_Diagnoses_Report_Click()
On Error GoTo Err_Print_Diagnoses_Report_Click
Dim stDocName As String
stDocName = "DIAGNOSES By Unit"
stLinkCriteria = "[DIAGNOSES]='" & Me!cboDiagnoses
& "'"
stLinkCriteria = "Between [UNIT]='" & Me!cboUnitFirst
& "'"
stLinkCriteria = "And [UNIT]='" & Me!cboUnitLast & "'"
DoCmd.OpenReport stDocName, acPreview
Exit_Print_Diagnoses_Report_Click:
Exit Sub
Err_Print_Diagnoses_Report_Click:
MsgBox Err.Description
Resume Exit_Print_Diagnoses_Report_Click
End Sub
I have also tried many other attemps to no avail. Why
doesn't this work and how can I get it to work?
Included below is the code to the report query just in
case it is needed:
SELECT PATIENTS.CDC_NBR, PATIENTS.LNAME, PATIENTS.UNIT,
DIAGNOSES.DIAGNOSES, DIAGNOSES.Doctor,
DIAGNOSES.TypeOfTest, DIAGNOSES.[Test Results], *
FROM (PATIENTS LEFT JOIN DIAGNOSES ON PATIENTS.CDC_NBR =
DIAGNOSES.[CDC#]) LEFT JOIN [Schedule Details] ON
DIAGNOSES.DATE = [Schedule Details].ScheduleDate
ORDER BY PATIENTS.UNIT, DIAGNOSES.DIAGNOSES;
Thanks
Dennis