[Solved] Can buttons open and close forms?
[Solved] Can buttons open and close forms?
I am trying to use two different buttons in my forms; one to open another form, and one to close it. But i can't figure out how to do it! there are plenty of preset actions, but none of them open and close forms.
Last edited by lankymjc on Sat Apr 25, 2009 5:20 pm, edited 3 times in total.
OOo 3.0.X on Ms Windows XP
Re: Can buttons open and close forms?
[Solved] Closing form with macro
Use property "Additional Info" to specify the name of the form to open.
Assign this macro to the button's event "Before Commencing":
The button must belong to a top-level form rather than a subform.
Use property "Additional Info" to specify the name of the form to open.
Assign this macro to the button's event "Before Commencing":
Code: Select all
Sub openFormByTag(oEv)
REM OOo3.0: Reads the form name from a calling control's tag
cWhat = com.sun.star.sdb.application.DatabaseObject.FORM
oModel = oEv.Source.getModel()
sName = oModel.Tag
oView = oModel.Parent.Parent.Parent.Parent.getCurrentController()
oView.loadComponent(cWhat, sName, FALSE)
End Sub 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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Can buttons open and close forms?
Where do I put the macro? I can't find where to write it into
OOo 3.0.X on Ms Windows XP
Re: Can buttons open and close forms?
[Tutorial] How to install a code snippet
Next version 3.1 will allow for macros embedded in database documents. Since this macro is designed to work with any embedded form, you may prefer the global container.
Next version 3.1 will allow for macros embedded in database documents. Since this macro is designed to work with any embedded form, you may prefer the global container.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Can buttons open and close forms?
I can get it to open another form on demand, but I still can't get it to close it; that link you gave me wasn't particularly helpful (little ole me just got confused!)
OOo 3.0.X on Ms Windows XP
Re: Can buttons open and close forms?
You can use a button to open a URL such as http://google.com or file:///tmp/document.odt
Most office commands have URLs too. One of them is .uno:CloseDoc which corresponds to menu:File>Close
Most office commands have URLs too. One of them is .uno:CloseDoc which corresponds to menu:File>Close
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: Can buttons open and close forms?
Button properties
Action: Load document or web page
URL: .uno:CloseDoc
or call menu:Insert>Hyperlink...
Action: Load document or web page
URL: .uno:CloseDoc
or call menu:Insert>Hyperlink...
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Can buttons open and close forms?
Thanks
This helped me a lot.
Can you use buttons to generate reports as well? If so, how would the macro need to be changed?
Thanks again.
This helped me a lot.
Can you use buttons to generate reports as well? If so, how would the macro need to be changed?
Thanks again.
OOo 3.0.X on Ubuntu 8.x + WinXP
Re: [Solved] Can buttons open and close forms?
When I change ...
... to ...
... the office freezes. It's one of hundreds of bugs in the database API.
Do you know the switchboard extension? Obviously it contains working code to open a report. I don't waste more time with this branch of the API, particularly not for gimmicks like loading a report with one click.
Code: Select all
cWhat = com.sun.star.sdb.application.DatabaseObject.FORMCode: Select all
cWhat = com.sun.star.sdb.application.DatabaseObject.REPORTDo you know the switchboard extension? Obviously it contains working code to open a report. I don't waste more time with this branch of the API, particularly not for gimmicks like loading a report with one click.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Re: [Solved] Can buttons open and close forms?
Hi Villeroy,
you helped me also a lot with that macro, too,....many thanks,
Next questions:
How can i transfer data with that macro?
Example: When I have data "Green Monster" in form A, than I want that the data of "Green Monster" also appears in the next form B ... so that I can go on working easily....
I tried different possiblities, but nothing works out... (post/get ... etc)
Jens
you helped me also a lot with that macro, too,....many thanks,
Next questions:
How can i transfer data with that macro?
Example: When I have data "Green Monster" in form A, than I want that the data of "Green Monster" also appears in the next form B ... so that I can go on working easily....
I tried different possiblities, but nothing works out... (post/get ... etc)
Jens
OOo 3.1.X on MS Windows Vista
Re: [Solved] Can buttons open and close forms?
Normally you would use a subform attached to the same form document.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
-
ChristyMcFadden
- Posts: 3
- Joined: Thu Dec 01, 2011 10:59 pm
Re: Can buttons open and close forms?
This macro helped me open a form, but can it be modified to open a specific record within a form? Thanks in advance.Villeroy wrote:[Solved] Closing form with macro
Use property "Additional Info" to specify the name of the form to open.
Assign this macro to the button's event "Before Commencing":The button must belong to a top-level form rather than a subform.Code: Select all
Sub openFormByTag(oEv) REM OOo3.0: Reads the form name from a calling control's tag cWhat = com.sun.star.sdb.application.DatabaseObject.FORM oModel = oEv.Source.getModel() sName = oModel.Tag oView = oModel.Parent.Parent.Parent.Parent.getCurrentController() oView.loadComponent(cWhat, sName, FALSE) End Sub
Open Office version 3.3 on Windows 7
Re: Can buttons open and close forms?
Yes.ChristyMcFadden wrote:...can it be modified to open a specific record within a form?
See the following:
Open a Form filtered
RPG's Tutorial: Open Form with Macros
Some problems can crop up if you use the Open Document event
...
AOO 4.1.x; LO 4.2.x; Windows 7/8 64-bit
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria
Warning: Avoid embedded databases --> Solution: Adopt a portable 'split database' folder
Soli Deo gloria