LIBREOFFICE BASE - CREATE A SWITCH BOARD TO OPEN FORMS USING A PUSH BUTTON
Vložit
- čas přidán 8. 09. 2024
- If you liked this video donate: www.paypal.com...
PLEASE READ SINCE DOING THIS VIDEO LIBREOFFICE 4.1 now only likes UPPERCASE and LOWERCASE to be exact as they programmed it. See Below.
Your code:
oNewFormDocument = ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
Change to:
oNewFormDocument = ThisDataBaseDocument.FormDocuments.getbyname(sNewDocumentName).open
Notice 'ThisDataBaseDocument' The B in base has to be UPPERCASE for the switch board to work in LibreOffice Base 4.1
As you may or may not know creating a push button to open a form in Libreoffice Base is non existent. Unlike in Access where there is a little wizard to do all the work for you. This Video shows you how to use Libreoffice Basic/Macros to force a button to open a form.
This video demonstrates a basic switch board with 3 forms.
I'd refactor this a bit... create another subroutine "OpenForm (formname as String)" (if that works here) which then in turn contains the long line for actually opening the form, and call it instead of defining the constant and then doing the long line in each OpenForm_X routine, so that the only line in sub OpenForm_3 would be "OpenForm "Form3"".
This is really great, plain and simple. Saved me a lot of pain!
EXCELLENT! Really outstanding tutorial. Easy to understand and follow and, although there are slight differences, worked very nicely with LO78. Great intro to BASIC as well as macros. THANKS!
Your welcome :-)
Awesome video. THANK YOU! Finally, someone who could explain it correctly and without having it take 2 hours LOL
If after doing this video 9 years ago, is finally to you then great glad to have helped 😂
@@shanepiper please make more Libre Office Base videos!
@@mividalocastudio9366 kind of defeats the whole purpose of the channel being called Odoo made Easy... But if I was to do so what content would you want?
Great job! It was very helpful. It was just what I needed. Thanks, John
Glad I could assist you John :-)
Thank you. It worked in LO7.4.
that is really good to know thanks for the reply
This is a great video. Straight and to the point, easy to follow (even with the accent :). Yes I'm a Yank....
Thank you!! I have been searching all over for something like this!
Glad to be of assistance 😊
Brilliant,you made it so simple.
Thanks
Thanks for a great tutorial.This is no longer a mystery
I'm glad it has helped you 🙂
This video is amazing and exceeded my expectations. Thank you so much!
Thanks for taking time to make this video! It was very helpfull.
Nick (Cape Town).
Hello Ian, I am pleased that you have the Sub forms working.. I would suggest that you take a look at the security options and ensure you have macros enabled.
you are cool... thanks
I am interested to create a small guide about the basic programming language in libreoffice and small examples(only in writing not videos :D ) to help people creating powerful forms with libreoffice.
As I said before THANK YOU for your time , creating those videos and helping the community and reading my post.
thank you very much! Great job. Keep doing it.
This is great thanks- but how do I get the switchboard to open when the database launches ???
I think you can rule out the MySQL side as the LO Basic only calls the form within LO Base. I run a test today at work for you on my windows system of which I am using OpenOffice 4.0.0 and all seems to be working fine. There was no need to add a database as I mentioned its not really required for this exercise.
I would suggest removing the '.' in your form and the macro so your form reads "FedSaintsNewStory" and not "FedSaintsNew.Story"
Thanks,! saved me!
Your welcome nice to know a video I posted years ago is still helping 😊
2 questions:
How can I make the switchboard buttons not only open their respective forms but also simultaneously close all other forms?
How can I display all forms, including switchboard, without the menus and toolbars? i.e. make it look more like an end user application.
Thank You Very Much!
Tks Shane for your reply!!
YES - I have macros enabled - I've tried 'Med' and 'Low' and no diff. It does not "see" the Macro so that I can select it. The OK button remains grayed-out. I'm sure this was working fine in earlier LO versions. Maybe I must revert to ver 3 or 4.0??
Great. How to create push button macro in openoffice
نريد المزيد من الدروس التي تشرح كتابة كود
We want more of the lessons that explain in writing code
OK - I've tried the Form Name with and without the DB name in front of it - No change.
So I started up my old Laptop running the embedded HSQL and LO 3.6.5.2 and did the same set-up of the Form and the Macro - AND IT WORKS!!
So that means the problem is either with my new MySQL engine or the new Version of LO (4.1.1.2) I would think!!
Your comments - and what do you use (LO version and DB engine)??
thks you man :) very helpful.
thanks very much
If you want to open up a new questionnaire you simply tell the Main form that you want to only have the form set to 'Add Records' right click on the questionnaire form, press 'Edit' now open up the form navigator. location the main form, this should be at the top, right click it and choose 'Properties', click the Data tab and set the 'Add Data Only' to YES. This will tell Libreoffice to only show a new blank record. If you want review the data copy and paste another form and set ADO to NO.
I have found the issue with the script,
LibreOffice Basic is now very particular with Upper and Lowercase letters in variable.
Your code:
oNewFormDocument = ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
Change to:
oNewFormDocument = ThisDataBaseDocument.FormDocuments.getbyname(sNewDocumentName).open
Notice 'ThisDataBaseDocument' The B in base has to be UPPERCASE for the switch board to work.
I would like to ask some questions.
First, if you could make a video how to create a filter form, a form which has some list-boxes above (like filters )and under those is a table control with some records which are filtered by the list-boxes.
Second, if you could give some quides about API basic programming language in libreoffice. I "google" it but there is not any basic tutorial about the API only some forums pages in open-office. Do I have to download the sdk .
For some reason the LibreOffice Devs never added a hyperlink function in LO Base or OO Base either... hmmm I guess a little bit of basic will have to be written for this then link the macro to a push button.
Your welcome.
Hi Shane,
Great video!
I followed you video and then found I could use a public sub to open any form:
Public Sub OpenForm(frmName as string)
oNewFormDocument = ThisDatabaseDocument.FormDocuments.Getbyname(frmName).open
End Sub
Then to open a form just pass the form name to the public sub:
Sub OpenForm1
OpenForm "Form1"
End Sub
now I can open forms from a button without having to remember the correct syntax
Hi Shane - Tks for your videos - great help!! I've now got my Sub Forms working but can't get this (Button to open Form) working!! I'm using PClinuxOS 2013. LO 4.1.1.2 and MySQL 5.1.55. Has something changed in LO 4 - I can't "see" my macro to be able to select it. Macro Selector - Macro Name remains empty??!!
Thanks for any help.
Thanx for this video. I am learning Libra Office because Quattro Pro has become too unstable. But doing the above in Quattro Pro would have been about a 100th of the time. Can somebody combine the power and ease-of-use of Quattro with the stability and price of Libra Office.
Please explain in a bit more detail as I am unsure what you are asking.
Thanks for the video! It's very helpful. I still can't get the second form to open when I click the button, however. It will open when I run the macro from Tools>Macros>Run Macro... but not from within the original form. Any ideas?
Adding onto what you already have is very different than creating from scratch... Kind a confused here mate!
Yes!! sorry for my english
Hi Shane - I replied yesterday but it does not seem to have gone through!! I DO have Macros enabled but this morning found an error in my syntax. I can now "see" my Macro to select it.
REM ***** BASIC *****
Sub OpenStoryForm
const sNewDocumentName = "FedSaintsNew.Story"
oNewFormDocument = ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
End Sub
BUT it still does not work - any ideas??
Dear Shane
Is posible open a form and get to last registred of the tablet association?
How can I write this?
Thanks
Next time can you make a tutorial about how to switch between a Form and an other Document which has a name in a row of the database?
Hi, thanks for the video. Could you tell me why you used the "s" and "o" in front of New when creating the third macro?
Cheers
Microsoft has a notation convention a lot of people use. It says the name of the variable should carry information about the type of data it stores. Thus, 's' commonly begins the names of variables that store strings, and 'o' commonly begins the names of variables that store objects. There are differences of opinion around whether this convention is good or bad.
Your welcome :-)
Is there a way to get rid of the toolbars when you open up the switchboard?
Nice, .... but how to open another form with current record in current form to be shown as current record in newly opened form ???
If you want to open another window of information create more thank one set of switch buttons and add a filter.
shane piper Thank you sir! Originally I thought making standalone forms / switchboard would be better for my DB, but I just dont like the cons to it. Self contained is much better for me.
I would also like to implement Krešimir Mihalj 's request into my DB. I have a product DB with a search form. On that form I would like to be able to click a result in the search and have it open that record in my Product Browser form. I will try to get it to work, but I may be asking for your help on that!! :D
Anyway thanks again for your tutorials! They have been a great help.
I can't see anything wrong with the script other than I would check that you have the form name correct.
const sNewDocumentName = "FedSaintsNew.Story"
It is CASE sensitive make sure the form you wish to open reads what is in the quotes.
OK Shane - Tried removing the '.' and no change.
Still nothing happens!!
I see an earlier version of LO is on the WebSite - I might try 4.0 tomorrow and see what happens.
Can we move this to eMail (I still have your address) - stop filling up your site with chit-chat??
Best regards and I appreciate the help!!
Thanks for the video, how can i create a drop down menu in form using libreoffice? please help if you know.
Thanks
Sir, i wanna ask how can i open a specific record of another form using buttons?
Example, i have 2 tables, TableA (w/c contain Name and Team) and TableB (Name and Points). I have 2 forms too, FormA and FormB, in both forms i have 2 records.
What if I'm in FormA Record2, can i make a button that will open FormB Record2?
FormA Record3 to FormB Record3? Thanks sir..
Just a quick question, what OS are you using? This is probably a stupid question
Hi! Thanks for this video. Do you know if this works in standalone forms?
If you have any trouble finding the information for opening a file using a macro in OpenOffice or LibreOffice on the net then please let me know.
Do you mean a link to a document that is stored on your PC/Server
I have libreoffice 5 installed and created a database of my game collection, and I noticed that this works when a form is in the root of the forms list. In version 5, I can create internal folders to organize my forms, but then I get an error message that it can't find the form I want to open. I've already tried entering a path but somehow it doesn't work.
I have a internal folder called "system overviews", which contains forms like "C64 overviews", "NES overviews", etc. my main form "gamelist" is in the root of the forms list.
So :
Sub Open_Gamelist
Const sNewDocumentName="gamelist"
oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
End Sub
Works just fine, since it is the root, but
Sub Open_C64
Const sNewDocumentName="/system overviews/C64 overviews"
oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
and
Sub Open_C64
Const sNewDocumentName="\system overviews\NES overviews"
oNewFormDocument=ThisDatabaseDocument.FormDocuments.getbyname(sNewDocumentName).open
Don't seem to work. I am using windows, both \ and / give the same fault. It looks like Libre office basic cannot open the form when it is a internal folder, or am I doing something wrong?
When I designed the video idid this with Linux. On windows I believe you need to declare the drive letter also. Eg c:/users/yourname/documents/libreofficefiles/c64 if you understand this... Hope it helps.
The folder is internal in the ODB database file itself (created with the gui, using the main menu Insert > Folder), as well as the switchboard. Once the folders are made you can drag items in them to get a more organized layout. I wonder if it is possible to refernce to forms that are stored in these internal folders.
I found out how to do exactly that, please check this code:
sub OPEN_A_FORM
const sNewDocumentName="YOUR_FOLDER_NAME_HERE/YOUR_FORM_NAME_HERE"
oNewFormDocument=ThisDataBaseDocument.FormDocuments.getByHierarchicalName(sNewDocumentName).open
end sub
I use Windows, but I think it doesn't have problems with Linux, since it's all internal folders.
dont work with last version
Hello can I ask which version you are using as I am using 7.1.6-2 Linux Community Edition. Can I ask have you installed JRE? Enabled Macros and set to medium and is your basic syntax correct. Do you get an error message?
I think the best thing you can do is take a look at the website forum. openoffice. org
Java must be instalt
+Leif Laursen Yes java is installed.
Check out this video I recently did I have a drop down box demo in there
watch?v=jI0lYLFXfgQ
OK : Base LibreOffice 6.3
Sub CloseFormForm1
thisDatabaseDocument.FormDocuments.getbyname("Form1").close
End Sub