Open a different form with a pushbutton, with content based on the sourse

Hi All,

I would like to be able to open a new form with a pushbutton, based on information of an other form.
I have a form, called fCompany, showing all people, by Surname, GivenName, related to that Company.
Personal information about people are entered and updated with a form called fPerson.

I would like to be able when a certain person is shown in form fCompany, to open fPerson, with their personal information showing, so information can be verified and if needed updated.

Any suggestions are appreciated.

Dream

Create a subform.

I am using a subform, and can open fPerson, but I want to be able to open fPerson where the PK of the Person is known. It is an external Writer form, residing in same filefolder as fCompany.

In principle, if fCompany shows an Employee Name, who has a PersonID of 100, I want to open the form fPerson, for that specific Person. If an other Employee is shown, I would like to be able to show that specific Person.

Hope this helps.

Dream

many2many.odb (16.1 KB)

Company form → Persons in Company → Person details



The 2 forms are heavily redacted as you can see.

Thanks for the suggestion, but in this situation I would like to not clutter fCompany with information that is in principle not relevant.
fCompany can show all the Employees (old, current, and new), who are recorded.
It does list the current ContactPerson(s) first.

On fCompany, I placed a button to open fPerson.
fPerson is the DataEntry form for People.

Because the Company has multiple Employees, and Personal and Related info is to be updated on a regular basis, it would be nice that I can easily jump to the form fPerson.
Now that can be done, but with more than 50,000 entries, it is kinda tedious to open fPerson, and then search for the specific Person.
Because all persons are entered and managed via fPerson, it would be nice that I can jump to the related Person info in fPerson directly.

Your suggestion is similar to what I would like, but I would like to open an ‘external’ document with a pre-set PersonID.

Dream

This does NOT sound like using a sub-form?
Also the typical database-solution will not open table and jump to, but show only the filtered part you need.
.
If you wish to open another form at a specific record, you need to store the information somewhere accessible, like it is often done via filter tables. Otherwise the place for storage will be in a macro, wich can read your form, then open your fPerson. But I was never tempted to program a “scroll to record” as filtering seems much more efficient (no need to load 50000 records) so my macro would contain a SQL-query with ... WHERE id=100 after reading the id from the originating form.

May be something like

sub button_Click(ev)
thisForm = ev.Source.Model.Parent
i = thisForm.findColumn("myColumn")
var = thisForm.getInt(i)
doc = StarDesktop.loadComponentFromURL(...)
form = doc.DrawPage.Forms.getByName(...)
form.Filter = """MyColumn"" = "& cStr(var)

but I would prefer sub-forms and sub-sub-forms as long as the screen is big enough to show all the info.

My initial thought was to use a pushbutton, use ‘Action’ ‘Open document/web page’ and ‘URL’, where URL is fPerson.odt.
This works for opening fPerson, so I can now lookup the person of interest I need to update, and then close fPerson again, so that I can continue working on fCompany.

My question for the forum was and is: Can I use a preset, to open fPerson, so that I do not have to find the specific person, but that fPerson opens with that information.
It would be nice to have something like this for the URL: ‘file://media/fPerson.odt; PersonID’, where fPerson opens with information about the person with the PersonID shown in fCompany.fAddress.fPerson, where fAddress is a Subform of fCompany, and fPerson is a Subform of fAddress.

fCompany shows the minimal information of a person who can be selected as an employee for the company on a certain Address. It draws its information directly from vPerson, which is a View of information stored in the table tPerson.

Hopes this clarifies my lines of thought.
I am hoping the solution is that simple, but you have more knowledge and experience I will ever have in my life, dear master Villeroy.

Dream

Simple as this:
Form1.odt (16.2 KB)
Form2.odt (12.8 KB)

P.S. because the “identifier” in the biblio table is a string, I had to wrap the variable in single quotes.

This is indeed the principle.
However, I cannot figure out the following part: form.Filter = “”""& cThere &""" = ‘"& cStr(var) &"’".
It appears it needs to be: form.Filter = “”""& cThere &""" = “”"& cHere &"""", but there is an exception.

.
However, the form “!fPerson26-05-2025@7.21PM.odt” does open.

Dream

Open the form for editing, switch to design mode, apply some valid filter, turn off design mode and look at the form’s Filter property on the Data tab. It might be the string "ID" = 5 with no single quotes nor double quotes around the 5.