use a button from a form to open a new form at a specific record

I have a form with the general view of each athlete and a I need a button to view the biography of that athlete in a new form.
I made a simple macro that opens the right form, but it open’s it always on the first record.

Hello,

My answer in this post → Base macro that opens a new/clean record in another form contains, in the edited section of the answer, a base sample: PassFormDataWithNoGlobal.odb

That sample contains macros passing data to either open a specific record or a new record. This code is also presented using a global variable to get the result or without this global variable.

I have already tried your example and the 3 macros but nothing worked. In the example the button Get Details opens always the new form at the first record. The button Get New record return an runtime error (Type: com.sun.star.sdbc.SQLException)

@minosse,

Your comment is not quite clear. Are you having this problem with the sample posted or using the code itself?

Have just downloaded from that post Sample - PassFormDataWithNoGlobal.odb and re-tested. All works fine. Using form Customers will give selected results for the following selected ID’s - 123, 124, 125, 126, 127 & 133. In Using CustomersNoGlobal an additional message is generated if there is no detail record.

@minosse,

There is a different sample in my answer here → Base Macro - Click on Table Row to Open Record. On form CustomersGrid, clicking on any row will open that record in a different form. Clicking on non row in grid will open form with last record opened. New record form is opened when new line clicked.

You have not provided your specific LO version, OS or database you are using.