Hello
Tried to find it on the web, but couldn’t up to now…
I have a form document in Base (let’s say MyFormDocument) in which I have a main form (MyMainForm) and two subforms (MySubform1 and MySubform2).
In each of the subform, I have a control table, with same configuration (the two point to the same data table, but have each a different filter), named so MyControltable1 and MyControltable2.
Finally, I have a push button.
edit: I attach an example odb document: example.odb
What I would like is, when I select a row in a control table, and then press the push button, to be able to get (in a macro) the name of the control table. I’ve begun to formalize this in the following macro:
Sub MyMacro
oForm = ThisDatabaseDocument.FormDocuments.getByName( "MyFormDocument" )
oForm = oForm.Component.DrawPage.Forms.getByName("MyMainForm")
' now, how can I get the name of subform/table control I selected a row in before pressing the push button?'
End Sub
I’ve seen some pieces of code that deal with for eg. oEvent.source.model.name
, but this provide the name of the push button…
Is there a property/method associated to MyMainForm (or other…?) that would provide the last “active” control/focus/cursor position before pressing the button?
Or when clicking in the table control, generate a global (?) variable that stores the clicked row to be used then in a sub launched by the push button? (then, how to get control of the “current” control table without having to name it?)
Is all that impossible…?
Maybe to provide the objective of all of this: I’ve built a planning by replicating the same table control in many subform, each subform being filtered on a specific date. In each table control, so, I’ve been able to populate with all the events that are planned (or occured) on a specific date. From that, I would like to click on a specific event (meaning a specific row in the control table of a specific day, so subform), press a button, and be transfered to another form document that provide details on the selected event (indeed, in the planning, only few details are providing).
Thanks a lot for any track to resolve this need!