Print current record...report with subreport

snorf3

Registered User.
Local time
Today, 03:15
Joined
May 25, 2001
Messages
45
Ok. This might sound a little confusing but I really need some help!

I have a form containing personal info (ie. Name, DOB, address, etc.) and a subform linked by PatientID that contains a record for each visit to the clinic. The two forms are each based on a table (main form = tblPatientInfo, subform = tblClinical).

I also have a report that contains the personal info, with a subreport for each visit embedded in it.

Both the main form and main report use [PatientID] as the primary key, but the subform and subreport use two values as primary keys: [PatientID] and [VisitNo].

I want to put a button on my form that will print only the report for that specific patient and that specific visit. Since I need to use 2 primary keys to identify both my patient and the visit, I'm encountering a lot of difficulty with this.

Any ideas/suggestions/solutions are greatly appreciated!

PS. I've tried to use the OpenReport action but I can't get the syntax right for it to work.
 
I can't use the Print Current Record wizard button because that causes my form to print and not my report to print...and my form does not fit on a single page...I get 8 pages with little cut-off sections of my form.

Instead, I've now put a command button on my subform and it has the following event procedure:
--------------------------------------------

Private Sub OpenReportButton_Click()
On Error GoTo Err_OpenReportButton_Click

Dim stDocName As String

stDocName = "rptVisitSummary"
DoCmd.OpenReport stDocName, acPreview, , "[Health_Care_No]='" & Me![Health_Care_No] & "' AND [Visit_No]='" & Me![Visit_No] & "'"

Exit_OpenReportButton_Click:
Exit Sub

Err_OpenReportButton_Click:
MsgBox Err.Description
Resume Exit_OpenReportButton_Click

End Sub
--------------------------------------------

Now, when I click on this button, I get a "Enter parameter value" box asking me to enter the Visit_No.

If I then enter the number that is currently displayed on my form, the reports (emphasis plural) for that patient then open up....all of them, not just the one visit. On the plus side no reports are opened for other patients, so I know it is recognizing the Health_Care_No field.

So. How can I fix it so that I don't need to "enter parameter value" for my Visit_No and so that it opens only the specific visit report and not all the visit reports?

It feels so close yet so far........ :-)

[This message has been edited by snorf3 (edited 06-25-2001).]
 

Users who are viewing this thread

Back
Top Bottom