Need Help with Report

G

Guest

I have a main from and subform. Main form looks up a doctor and the subform
lists the doctor's patients. On the main form there are command buttons to
print specific report for these patients. However, when I click on report
the report comes up with only 4 out of the 5 paitients. It does not pick up
the first patient. Everything else works fine except that one. This is my
code for the report. I do have requery in my main form. Even after I
requery, it will no show all 5 patients. I would appreciate any help anyone
can give me with this. Thank you.

Private Sub ADOLVC_Click()
On Error GoTo Err_ADOLVC_Click

Dim stDocName As String

stDocName = "rpt ADOLVC"
DoCmd.OpenReport "rpt ADOLVC", acPreview, , "[PR ID]=" & Me![PR ID]

Exit_ADOLVC_Click:
Exit Sub

Err_ADOLVC_Click:
MsgBox Err.Description
Resume Exit_ADOLVC_Click

End Sub
 
G

Guest

I'm not sure what PR ID is... Is this the doctor? What happens if you open
your report in design view and find the record source. View the design view
of your record source and set the criteria under the [PR ID] field to the
actual number.

Your code assumes PR ID is numeric. Is this true?
 
G

Guest

Yes, "PR ID", was referring to Doc ID. Working now. Thank you very much.

Duane Hookom said:
I'm not sure what PR ID is... Is this the doctor? What happens if you open
your report in design view and find the record source. View the design view
of your record source and set the criteria under the [PR ID] field to the
actual number.

Your code assumes PR ID is numeric. Is this true?

--
Duane Hookom
Microsoft Access MVP


TotallyConfused said:
I have a main from and subform. Main form looks up a doctor and the subform
lists the doctor's patients. On the main form there are command buttons to
print specific report for these patients. However, when I click on report
the report comes up with only 4 out of the 5 paitients. It does not pick up
the first patient. Everything else works fine except that one. This is my
code for the report. I do have requery in my main form. Even after I
requery, it will no show all 5 patients. I would appreciate any help anyone
can give me with this. Thank you.

Private Sub ADOLVC_Click()
On Error GoTo Err_ADOLVC_Click

Dim stDocName As String

stDocName = "rpt ADOLVC"
DoCmd.OpenReport "rpt ADOLVC", acPreview, , "[PR ID]=" & Me![PR ID]

Exit_ADOLVC_Click:
Exit Sub

Err_ADOLVC_Click:
MsgBox Err.Description
Resume Exit_ADOLVC_Click

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top