| View previous topic :: View next topic |
| Author |
Message |
sprudhom Newbie

Joined: 30 Aug 2008 Posts: 1
|
Posted: Sat Aug 30, 2008 6:33 pm Post subject: Button |
|
|
Hi, it is possible put a button in a form that open an other form to make a kind of menu.
Thanks |
|
| Back to top |
|
 |
Voobase OOo Advocate


Joined: 21 Nov 2007 Posts: 400 Location: Australia
|
|
| Back to top |
|
 |
valmorel General User

Joined: 15 Jul 2008 Posts: 35 Location: UK
|
Posted: Sun Aug 31, 2008 5:11 am Post subject: |
|
|
This is the code you need. I did not create it myself, I collected it from a forum. The only thing you need to change is YOUR_FORM_NAME in the last line, which you change for the name of the form you wish to open.
You could also change the last line for this one to open a report instead of a form.
NewReportDoc=DBDoc.ReportDocuments.loadComponentFromURL("YOUR_REPORT_NAME","_blank",0,Args())
THE CODE YOU NEED:
Sub OpenForm(Event As Object)
Dim Form As Object
Dim FormDoc AS Object
Dim FormCollection As Object
Dim DBDoc As Object
Dim NewFormDoc As Object
Dim Args(2) As New com.sun.star.beans.PropertyValue
Form=Event.Source.Model.Parent
FormCollection=Form.Parent
FormDoc=FormCollection.Parent
DBDoc=FormDoc.Parent
Args(0).Name="ActiveConnection"
Args(0).Value=Form.ActiveConnection
Args(1).Name="OpenMode"
Args(1).Value="open"
NewFormDoc=DBDoc.FormDocuments.loadComponentFromURL("YOUR_FORM_NAME","_blank",0,Args())
End Sub |
|
| Back to top |
|
 |
rotomano OOo Enthusiast


Joined: 13 Dec 2006 Posts: 198 Location: Greece
|
|
| Back to top |
|
 |
|