Hi,
I'm attempting to make a report with multiple invoices in the body of the report and could use some guidance please!
So far, what I have is a form that has a multiselection listbox. First, the listbox can be filtered to a specific set of customers invoices.
After the user filters the listbox to a customer, they can select(highlight) whichever invoices they want to print.
Then they click a print button and it opens a report that looks like a form for printing or emailing.
I want this report to have a header, a subform with the invoices selected listed in rows, and a footer.
What I have right now though is: (and understandably as this is the current design) a separate report for each record selected in the listbox.
I think I am on the right track with creating a subform to display the listbox records along with a header and footer but I'm not sure how to alter the code to do this.
I'm not great at vba but I found the code below online and got it working for separate records.
Could someone please point me in the right direction?
Here is the code on the button that opens the report for the selected listbox items as of now:
Private Sub Command21_Click()
Dim var As Variant
Dim strReturn As String
For Each var In Me.List14.ItemsSelected
strReturn = strReturn & Me.List14.ItemData(var) & ","
Next
If Len(strReturn) > 0 Then strReturn = "So In (" & Left(strReturn, Len(strReturn) - 1) & ")"
''****
'fieldName is the field you want to filter
'then you pass the strReturn as Where condition of your Report.
DoCmd.OpenReport "rptMultipleInvoices", acViewPreview, , strReturn
End Sub
Thanks,
Brian
I'm attempting to make a report with multiple invoices in the body of the report and could use some guidance please!
So far, what I have is a form that has a multiselection listbox. First, the listbox can be filtered to a specific set of customers invoices.
After the user filters the listbox to a customer, they can select(highlight) whichever invoices they want to print.
Then they click a print button and it opens a report that looks like a form for printing or emailing.
I want this report to have a header, a subform with the invoices selected listed in rows, and a footer.
What I have right now though is: (and understandably as this is the current design) a separate report for each record selected in the listbox.
I think I am on the right track with creating a subform to display the listbox records along with a header and footer but I'm not sure how to alter the code to do this.
I'm not great at vba but I found the code below online and got it working for separate records.
Could someone please point me in the right direction?
Here is the code on the button that opens the report for the selected listbox items as of now:
Private Sub Command21_Click()
Dim var As Variant
Dim strReturn As String
For Each var In Me.List14.ItemsSelected
strReturn = strReturn & Me.List14.ItemData(var) & ","
Next
If Len(strReturn) > 0 Then strReturn = "So In (" & Left(strReturn, Len(strReturn) - 1) & ")"
''****
'fieldName is the field you want to filter
'then you pass the strReturn as Where condition of your Report.
DoCmd.OpenReport "rptMultipleInvoices", acViewPreview, , strReturn
End Sub
Thanks,
Brian