Frank Schönheit wrote:

Hello Andrew,



I am so close, I can smell it, but it does not work. Any comments on the steps that I am missing... I think that I need to set default keys and that sort of thing...

The following macro tries to create a databsae document...



Which part of your macro is alerady working, and which isn't?

I'd suggest something along those lines:

' create a new DB document
oDBContext = createUnoService( "com.sun.star.sdb.DatabaseContext" )
oDB = oDBContext.createInstance();
oDB.URL = "sdbc:embedded:hsqldb"
oDB.storeAsURL( ConvertToURL( "C:\OODB\Address01.odb" ) )
 ' storing is important. Before you do any real work with the
 ' DB, store it. Else, lot of operations won't work as expected.

' connect
oConnection = oDoc.getConnection( "", "" )

' get the tables
oTables = oDoc.getConnection().getTables
' create a new table
...

' clean up
oConnection.close()
 ' note that this will implicitly flush any possibly pending
 ' changes you did

' store the document
oDB.store()


Note that a major difference here is that I used the DatabaseContext to create a new DB document. Such docs to not appear in a frame. If you need to see the document, you should use your version with the loadComponentFromURL.

Ciao
Frank


Thanks Frank.... This is very useful for me to see.... I was not getting the connection and then creating the tables using the connection... Also, I was not aware that I needed to save the document BEFORE doing other things...

This helped a lot! I think that I am starting to the hang of this!


-- Andrew Pitonyak My Macro Document: http://www.pitonyak.org/AndrewMacro.sxw My Macro Book: http://www.hentzenwerke.com/catalog/oome.htm Free Info: http://www.pitonyak.org/oo.php


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to