Hello,
There are different methods to accomplish what you ask for. Attached is the sample you have provided. It has a filter table included (one record) to hold the invoice # to be printed. The query was modified to use this field for report selection. There is a separate form, PrintInvoice
for selection of what is to be printed. It contains a list box to select the wanted invoice and a push button. The push button is attached to a short macro:
Option Explicit
Sub OpenReport
Dim oController As Object
Dim oReportDoc As Object
oController = ThisDatabaseDocument.currentController
if not oController.isconnected then oController.connect
oReportDoc = Thisdatabasedocument.reportdocuments.getbyname("rpt_Invoice-pt2").open
End Sub
which executes the report.
Sample — odb78-Invoice-pt4c-TheInvoice.odb
There are other ways to do this such as creating a table containing just what is to be printed. See as reference → Asking for help with Temporary Tables y LibreOffice Base and also → How does the “SELECT INTO” work in Base. There are certainly other methods.
You could also include a field in the record for print selection and base printing upon this being set. You do need to clear the field after printing.
Edit 2020-05-19:
Have modified the first sample. Still uses the filter table. Just a matter of movint the ID to the table and then print the form. Button added to Invoices
form. This button is attached to PrintCurrent
macro.
Sample ------ odb78-Invoice-pt4c-TheInvoice.odb