Page 1 of 1

Open form function problem

Posted: Mon Apr 07, 2008 7:58 pm
by Lazy-legs
Hello,

I'm using the following function to open a specified form in a database (borrowed from http://user.services.openoffice.org/en/ ... =20&t=2326):

Code: Select all

Function OpenForm (FormName As String) as Object
Dim Context As Object
Dim DB As Object
Dim Conn As Object
Dim FormDoc As Object
Dim Form AS Object
Dim Args(1) As New com.sun.star.beans.PropertyValue
Context=CreateUnoService("com.sun.star.sdb.DatabaseContext")
DB=Context.getByName("WriterDB")
Database=DB.getConnection("","")
Args(0).Name="ActiveConnection"
Args(0).Value=Database
Args(1).Name="OpenMode"
Args(1).Value="open"
FormDoc=DB.DatabaseDocument.FormDocuments.loadComponentFromURL (FormName,"_blank",0,Args() )
End Function
But here is the problem that really baffles me. When I add a new record or made changes to an existing one using the opened form, all changes are gone as soon I close OpenOffice.org. I have absolutely no idea why this happens.

Kind regards,
Dmitri

Re: Open form function problem

Posted: Tue Apr 08, 2008 1:29 am
by DrewJensen
Hi Dimitri,

Damn - that is issue 86855 and someone forgot to go back and put up the advanced code needed to open a form for the internal QA staff so they could confirm this.

Anyway - the work around is to open the ODB file first ( hide it if you like ) and then the changes are permanent -

Want an example?

Re: Open form function problem

Posted: Tue Apr 08, 2008 11:01 am
by Lazy-legs
Hi Drew,

Ah, I see. This is a rather annoying bug, but I think I can figure out how to open a database before I open a form. If I can't, then I get back and beg for your help. :)

Kind regards,
Dmitri

Re: Open form function problem

Posted: Tue Apr 08, 2008 1:20 pm
by DrewJensen
LOL - no I knew you could..