Printing a Report from a Form

I’d like to print a report from a form, with an ID passed to the report query from the form. I have the form, which works, and the report, which also works but with a hard criterion entered into the query.

I expect to put a command button on the form which will trigger the opening of the report for the active record, using the ID exposed by the form as the variable. It’s been over twenty years since I did this in Access, and I can’t seem to find examples in LO.

Could someone post an example of the code needed under the command button on the form? (including the full name of the form and whatever object references might be needed.) Many thanks in advance.

Hello,

There are a number of these posted on the sight. Here are a few:

Base: Print Button

How to create report after user inputs number into a form?

Printing reports from an external form

Thank you. None of these showed up in my searches. I appreciate your help.