Base: printing report, macro

Hello everyone,

I’m a newbie to libreoffice base. I’m trying to make a database for invoices and product store.
After creating a tables, forms, queries I’m not able to send a report print that is based on a query.

I try to explain better. I have form where is possible to create an invoice. The invoice report is based on a query that ask WHAT “ID invoice” number to print. Now if I want to print the invoice “44” for example I have set up all so it ask me the input when I launch the “Invoice report” (This was set from the query).

Now I need a button on my “invoice form” that bring automatically the “invoice number” and send the print report without asking any input the user.

Is that possible only by macro? If yes how I have to do? I don’t know any program languanges.

Thank you in advance for your support. I apologize if my english is not perfect :slight_smile:

Based upon the information provided, it appears you have a form which creates an invoice which the user then fills out. It appears you want to then be able to, using a button, print this new invoice using an existing query which asks for an invoice number.

This is possible using macros but complicated for an outsider to direct on how to do it. First, Basic (primary LO macro language) in itself is not too difficult but other factors ( API & such) make it much more difficult to understand. Even if someone were to give you the code, some day things may change and you would once again be faced with the problem on how to get the code changed.

And for someone to get this code working for you, form details, query information and report information is needed. All this needs to be tied together to work properly.

You probably should just keep the current set-up where the query asks for the invoice number to be printed.

Thank you fro your kindly reply. I think I will keep the database and make it work as it. What do you mean about API? Should I get any API in order to make it work?

I would ask another thing. I used

WHERE “IDinvoice” LIKE ‘%’ || :input || ‘%’

in order to make it ask the invoice number to users.
What any other way I can use to get the invoice number to print (except macro as mentioned before) ?

Most of the other ways are more tedious than what you are using and require more user interaction to complete. :input is the method for parameter entry but you can be a bit more specific:

WHERE "IDinvoice" = :InvoiceToPrint. That is a little more specific to the user as to what is expected to be entered.

Ok thank you I will try by this