Button to open new form - macro?

I am creating a database for data collection for a disability screening of both child and adult populations. I have a basic demographic form, and would like to create buttons on that form which open up the correct screening form based on age group (3 forms total). I suspect I could do this through a subform contained within the page(?), but I think that would make the whole thing unreasonably long, ugly, and complex. I believe this will require creating a 1:1 relationship, since each primary key could have one entry at most in each screening form, but many would have none since only 1 of the 3 screening forms will apply to each primary key.

Desired Function:

  1. Create 3 buttons within the main form which:
  2. First saves the data that has been entered,
  3. Then opens the specified screening form,
  4. And auto-populates the Study ID (which will be the foreign key on the screening forms).

Probably this will require writing a macro I suspect, which I haven’t learned yet, but if you could point me in the right direction I would appreciate it.

Thank you kindly.!

demographic form screenshot


Once you head toward macros you are going to encounter a steep learning curve. You will find a good deal of information on this post → To learn LibreOffice Base are there introductions or tutorials?.

To give you some idea of how this can work, see my answer on this post → Base Form macro basic command “how to open Form on new record state ?”. In the answer there are further links to other answers containg samples and more information.

Ok great. Just what I’m looking for.

But you’re certainly correct that it’s going to take me some time to get it figured out. Do you have any recommendations about shorter workarounds? Even if that means somewhat reduced functionality…

Here is my bigger knowledge gap: what is the “preferred” way to deal with subforms when not every subform is relevant for each record, and all sub forms are relatively large? Basically it is just a real estate problem. All the tutorials I’ve read or watched deal with the sub forms as visible within the main form. That is terribly impractical in my case.

Thank you again!

@plw There are many methods to deal with sub forms but “prefered” is not typically mentioned. Your main form appear overly busy and it would not be a surprise that some of the data doesn’t belong.

With a very minimum of macro code, you could use sections. With sections you can place the main form on one section and sub forms each on its’ own section. Use Buttons to execute code to hide/reveal sections. See my sample in this post → Tabbed forms within a Main Form. Note that there is a link to another sample in the comments there.