I'm struggling with the documentation to find a way of opening forms and reports using OpenOffice Basic code. Does anyone have examples or can point me towards some docs/web pages?
Thanks in advance.
[Solved] Accessing database documents via Basic
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
[Solved] Accessing database documents via Basic
Last edited by Hacker John on Fri Jan 04, 2008 12:17 am, edited 1 time in total.
-
- Volunteer
- Posts: 283
- Joined: Tue Dec 04, 2007 6:38 pm
- Location: Houston, TX
Re: Accessing database documents via Basic
you can goto http://www.geocities.com/rbenitez22 and goto the OpenOffice.org link.
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
Re: Accessing database documents via Basic
Thanks for the link - the docs look quite comprehensive. OO basic is a tad more difficult than Microsoft Office VBA but I'm sure I'll get there.
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
Re: Accessing database documents via Basic
I've had a look through umpteen documents but still no joy. I basically want to open a report by pressing a button in a form. I also want to be able to open forms from other forms. Does anyone know how to do this?
-
- Volunteer
- Posts: 283
- Joined: Tue Dec 04, 2007 6:38 pm
- Location: Houston, TX
Re: Accessing database documents via Basic
Code: Select all
Sub OpenForm(Event As Object)
Dim Form As Object
Dim FormDoc AS Object
Dim FormCollection As Object
Dim DBDoc As Object
Dim NewForm As Object
Dim NewFormDoc As Object
Dim Args(2) As New com.sun.star.beans.PropertyValue
Form=Event.Source.Model.Parent REM CODE BOUND TO FORM BUTTON
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"
docName="EMPLOYEES" REM CHANGE TO YOUR FORM/REPORT NAME
REM TO OPEN FORM DO
NewFormDoc=DBDoc.FormDocuments.loadComponentFromURL(docName,"_blank",0,Args())
REM TO OPEN REPORT DO
NewRerpotDoc=DBDoc.ReportDocuments.loadComponentFromURL(docName,"_blank",0,Args())
End Sub
-
- Posts: 25
- Joined: Thu Dec 06, 2007 1:17 pm
Re: Accessing database documents via Basic
Many thanks for that code - it worked a treat. I'll pick the bones out of it at my leisure. The only guide to the object model seems to be in Java so I assume that the objects are mostly the same in OOBasic.
Thanks again - this has been a great help.
Thanks again - this has been a great help.