[Solved] Open Form from List Box

Creating and using forms
Post Reply
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

[Solved] Open Form from List Box

Post by widowmaker »

What I am asking about may not be possible, but I don’t figure it will hurt to ask.

I know that a new form or sub form can be opened with a Macro or Button. What I would like to find out is if it is possible to use a drop down list to select which subform a person would like to use.

For example, when performing data entry, if someone has multiple subforms OR additional mainforms within the same master form, I would like for them to be able to select the subform they want to access by using a drop down list instead of having multiple buttons taking up space.

The ultimate goal here is to expand or shrink certain areas of focus within a form or page.
Thanks for any feedback.
Last edited by widowmaker on Tue Jun 09, 2020 8:51 pm, edited 1 time in total.
LibreOffice 6.0.7.3 on Linux Mint 19.3
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Open Form from List Box

Post by UnklDonald418 »

Since a listbox list is an array, I imagine it would be possible but that would involve some advanced macro programming. The general resource for LO/OO is "OpenOffice.org Macros Explained.odt V4" by Andrew Pitonyak which is a free download at
http://www.pitonyak.org/oo.php
But the the coverage of Base is minimal. When macro programming with Base, the book that I often refer to is
"Database Programming with OpenOffice.org Base & Basic" by Roberto Benitez which is still available for purchase from Lulu and Amazon. He does provide two Star Basic Subs for manipulating list box controls.
If you are going to delve into the dark world of LO/OO macros you will definitely need to install an object inspection tool such as
MRI extension
and learn to use it MRI tutorial link
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Open Form from List Box

Post by widowmaker »

Thank you for the reply, information and files. It is a starting point to at least let me know it can be done.
After seeing the code, it reminded me of something in the dark cobwebs of my memory banks from many many years ago when I used a VBasic code to set up tabs in a form to call up various subforms, thus reducing the time and load on an Access DB I created.

I should still have that code on an old Hard Drive, but I am not sure if it will work on LO. I will try to find it and see if maybe one of the younger minds that still remembers how to work with VB here could look at it and possibly convert it.

So, betwen the VB code used in Access and the code you sent me, it looks like I got a shot if it can be deciphered and reconstructed.

Thanks for your input
LibreOffice 6.0.7.3 on Linux Mint 19.3
UnklDonald418
Volunteer
Posts: 1549
Joined: Wed Jun 24, 2015 12:56 am
Location: Colorado, USA

Re: Open Form from List Box

Post by UnklDonald418 »

According to Andrew Pitonyak
"With respect to syntax and BASIC functionality, Basic is very similar to Visual Basic. The two Basic
dialects are nothing alike when it comes to manipulating documents"
If your problem has been solved, please edit this topic's initial post and add "[Solved]" to the beginning of the subject line
Apache OpenOffice 4.1.14 & LibreOffice 7.6.2.1 (x86_64) - Windows 10 Professional- Windows 11
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Open Form from List Box

Post by Villeroy »

The languages are the same. The thing you talk to is completely different. With VBA you talk to a second office suite very similar to the office GUI. With StarBasic you talk to the bare bones of highly sophisticated application.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
widowmaker
Posts: 21
Joined: Mon Apr 27, 2020 10:51 pm

Re: Open Form from List Box

Post by widowmaker »

I want to thank you guys for pointing out the different versions of Basic. It makes me realize just how out of date and old I am.

For someone that used to be able to play chess against 10 to 12 people at one time, while I was wearing a blindfold, it is difficult to admit that I can no longer concentrate long enough to remember the names of various databases or websites.

I thought that I “might” be able to find some old “cassette tapes” that had Basic programs I wrote back in the 1980s on my Tandy CoCo and convert them over so that I could use them on LO, but then I realized you can not hook up a tape player to these new computers. That let me to dig out my OLD Commodore 64 that I bought in the 1980s. That is when I realized I am getting way to old to do this crap.

So, I have decided to see if I can hire someone to create a non-macro basic program that will work on LO to open TABS for subforms. I can even furnish a Vbasic example script that was used in Access 15 plus years ago as a sample of what I would like.

I realize there is a different area on this board to post “For Hire” jobs, so I plan on continuing this post over there.

Thank you both for your input. It helped me to realize age is not kind and places limits on moldy minds.
LibreOffice 6.0.7.3 on Linux Mint 19.3
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Open Form from List Box

Post by Villeroy »

Again: 2 percent of the difficulty is related to the StarBasic dialect. This trivial script language is almost fully documented in the F1-help. The last books on Basic have been printed many years ago and they would not help very much because StarBasic is only a small subset of the original Visual Basic language of the 90ies.
98 percent of the difficulty has to do with the extremely complex application exposing itself to Basic or to any other language. No matter how proficient you are in Visual Basic or Java or Python or C++, as soon as you start talking to this office suite in your favourite beloved programming language, you struggle with the exact same difficulties. It takes more than a weekend of reading and excercising until you get an idea how to solve these problems efficiently.
Of course, writing a macro opening a form based on a list box entry is easy for me. However, this tends to become a never ending chain of new tasks because forum users can't get enough of this drug without ever really learning how to do it themselves. I'm tired writing macros by acclamation.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply