Form/subform module question

M

Microsoft

Greetings,

I have several reports that I create with buttons on a form. The code that
creates the report uses the current last name on the form to go to report
the proper record. I have a subform on the form that lists the individual
stays of guests from the form. The code below works fine for getting the
record for the current guest on the form. But many guests have several
records on the subform The code below just creates reports fopr all records
on the subform for the current guest record. While this is ok, I would
rather have the ability to only crate a report forthe current record on the
subform for the current guest. Is there a way to modify the below code to
do this?

Many thanks,
Scott B


Private Sub cmdWelcomeCard_Click()

Dim strReportName As String
Dim strCriteria As String

strReportName = "rptWelcomeCard"
strCriteria = "[LastName]='" & Me![LastName] & "'"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria

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