Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Hi

I do not reproduce you problem with ThisDatabaseDocument. You just have to connect as explained in this wiki page (in french, sorry but I hope that's understandable with the code and the sample database).

Regards

Hi

I do not reproduce you problem with ThisDatabaseDocument. You just have to connect as explained in this wiki page (in french, sorry but I hope that's understandable with the code and the sample database).

[EDIT]

The following syntaxes also work without problems in my environment:

sub PysOpen1

dim oConn as object, oForm as object
dim Prop(0) As New com.sun.star.beans.PropertyValue

oConn = ThisDatabaseDocument.DataSource.getConnection("","") 

Prop(0).Name = "ActiveConnection"
Prop(0).Value = oConn

oForm = ThisDatabaseDocument.FormDocuments.loadComponentFromURL("F_Client", "_blank", 0, Prop()) 

end sub
sub PysOpen3

dim oConn as object, oForm as object
dim Prop(0) As New com.sun.star.beans.PropertyValue

oConn = ThisComponent.DataSource.getConnection("","") 

Prop(0).Name = "ActiveConnection"
Prop(0).Value = oConn

oForm = ThisComponent.FormDocuments.loadComponentFromURL("F_Client", "_blank", 0, Prop()) 

end sub

Regards

click to hide/show revision 3
No.3 Revision

Hi

I do not reproduce you problem with ThisDatabaseDocument. You just have to connect as explained in this wiki page (in french, sorry but I hope that's understandable with the code and the sample database).

[EDIT]

The following syntaxes also work without problems in my environment:

sub PysOpen1
  dim oConn as object, oForm as object
 dim Prop(0) As as New com.sun.star.beans.PropertyValue

oConn = ThisDatabaseDocument.DataSource.getConnection("","") 

  dim UserName as String  : UserName = "foo"
  dim Password as String  : Password = "bar"
  oConn = ThisDatabaseDocument.DataSource.getConnection(UserName,Password) 

  Prop(0).Name = "ActiveConnection"
 Prop(0).Value = oConn

oForm = ThisDatabaseDocument.FormDocuments.loadComponentFromURL("F_Client",   dim FormName as String : FormName = "Form1"
 oForm=ThisDatabaseDocument.FormDocuments.loadComponentFromURL(FormName, "_blank", 0, Prop()) 
 end sub
 sub PysOpen3
  dim oConn as object, oForm as object
 dim Prop(0) As as New com.sun.star.beans.PropertyValue

oConn = ThisComponent.DataSource.getConnection("","") 

  dim UserName as String  : UserName = "foo"
  dim Password as String  : Password = "bar"
  oConn = ThisComponent.DataSource.getConnection(UserName,Password) 

  Prop(0).Name = "ActiveConnection"
 Prop(0).Value = oConn

oForm = ThisComponent.FormDocuments.loadComponentFromURL("F_Client",   dim FormName as String : FormName = "Form1"
  oForm=ThisComponent.FormDocuments.loadComponentFromURL(FormName, "_blank", 0, Prop())  
end sub

Regards