G
Guest
I have a form with client info and then a subform with client screening info.
Each client can be screened multiple times. So I have multiple screening
records related to each client record. I have a report set up with client
info and with a subreport with screening info. I need to be able to print the
current record for a client. I use the following code:
Private Sub cmdPrintScreening_Click()
On Error GoTo Err_cmdPrintScreening_Click
Dim stDocName As String
Dim stWhere As String
DoCmd.Save
Me.Dirty = False
stDocName = "rptScreening"
stWhere = "infSSSN ='" & Me.infSSN & "'"
DoCmd.OpenReport "rptScreening", , , stWhere
Exit_cmdPrintScreening_Click:
Exit Sub
Err_cmdPrintScreening_Click:
MsgBox Err.Description
Resume Exit_cmdPrintScreening_Click
End Sub
This works fine except for that if a client has mulitple screening records
(in the subform) it prints all of them. I just want to print the record that
is currently being displayed in the screening subform. I have a PK for the
table that the subform is based on and have a one-to-many relationship
between the client info table and the screening table. any ideas?
Each client can be screened multiple times. So I have multiple screening
records related to each client record. I have a report set up with client
info and with a subreport with screening info. I need to be able to print the
current record for a client. I use the following code:
Private Sub cmdPrintScreening_Click()
On Error GoTo Err_cmdPrintScreening_Click
Dim stDocName As String
Dim stWhere As String
DoCmd.Save
Me.Dirty = False
stDocName = "rptScreening"
stWhere = "infSSSN ='" & Me.infSSN & "'"
DoCmd.OpenReport "rptScreening", , , stWhere
Exit_cmdPrintScreening_Click:
Exit Sub
Err_cmdPrintScreening_Click:
MsgBox Err.Description
Resume Exit_cmdPrintScreening_Click
End Sub
This works fine except for that if a client has mulitple screening records
(in the subform) it prints all of them. I just want to print the record that
is currently being displayed in the screening subform. I have a PK for the
table that the subform is based on and have a one-to-many relationship
between the client info table and the screening table. any ideas?