Ask Your Question
0

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

asked 2021-01-07 16:12:18 +0100

minosse gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-01-07 18:45:52 +0100

Ratslinger gravatar image

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.

edit flag offensive delete link more

Comments

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 gravatar imageminosse ( 2021-01-08 12:52:29 +0100 )edit

@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.

Ratslinger gravatar imageRatslinger ( 2021-01-08 17:44:03 +0100 )edit

@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.

Ratslinger gravatar imageRatslinger ( 2021-01-08 19:45:38 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2021-01-07 16:12:18 +0100

Seen: 21 times

Last updated: Jan 07