Base Macro - Click on Table Row to Open Record
I'm working on a home screen (aka switchboard) for my Base document that has button links to all the various forms of my database. In addition, there are search boxes with table control search results. My hope is to be able to write a macro to launch a record edit form when clicking on a row in the search results I can figure out everything except I don't know how to access the active row (the one with the green triangle to the left). If I can detect which row is clicked, I can get the row's ID and pass that as a parameter to the form I open. I already have that all figured out, just don't know the part about active table row. Since button controls can't be inserted into table controls, I can't have a "open" or "edit" button for each row. The whole row needs to trigger on click. The search result table controls are read only, so I don't need to be able to change any data in them.
Here's a visual example of a search form. The search logic is already in place. I already know how to open a form via a macro. I just need an expert's tip about how to determine the active table row via code, and therefore the "Act #" column of that active row in this case (because accountnumber is the primary key I will use to edit that record in the account form). I can search by any column (Act #, Name, Address, City, etc) to produce the search results... but I want the Act# of the clicked row.
I have asked a question like this previously. (https://ask.libreoffice.org/en/questi...) The answer seems to be that there is no obvious way to do it, but you could use mri to search all the properties of the table ... if you have the persistence. Otherwise, make a form from the table, and use the existing handles to attach the data there. If you find a way to do it, I'd be very interested.
@Pansmanser,
Please see answers in the post. Your customized keystroke can call the macro which accesses any of the data within the table control using
Columns
from the data source and the selected row of data. Since your linked question is now 3+ years old and your requirements may be somewhat different, if you have further need, please ask as new question.Thanks again, Ratslinger. I perhaps misunderstood the question. My original problem was to do something like this working directly form the table, rather than through a form. At that time I was not familiar with forms. After recently learning a good deal more, I have now achieved what I wanted three years ago by working with a form rather than the table. Life is good!