Well, what do you know - it really was that easy..
There is just a little trick.
cntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext")
aProp(0).Name = "Hidden"
aProp(0).Value = True
StarDeskTop.loadcomponentfromURL( cntxt.getByname( trim(dbName)
).DataBaseDocument.URL,"_blank", 63, aProp())
DB = cntxt.getByname( trim(dbName) )
You must establish the connection using the variable DB set this way.
If you do this instead:
cntxt = CreateUnoService("com.sun.star.sdb.DatabaseContext")
aProp(0).Name = "Hidden"
aProp(0).Value = True
DB = StarDeskTop.loadcomponentfromURL( cntxt.getByname( trim(dbName)
).DataBaseDocument.URL,"_blank", 63, aProp())
Then you are lost - the fomdocuments container will never find the form?
Wonder why it should act that way.
With this change then the macro is 7/8ths of the way there to allow you
to arbitrarily open an embedded form in a registered Base file from a
command line.
There is no apparent glitches - you can open other forms, open and
create documents, close and exit - no errors no unexpected results at all.
The last piece then is to setup a little monitor that catches when the
last form on the desktop closes - actually for my purposes it will be
the last forum or document opened from our basic library/base
application and be sure to also close the Base file - if you fail to do
that and close the last OpenOffice.org window on the desktop then the
Base file is stuck in memory and have to kill the process to clear it.
But that isn't that hard to figure out...at all.
Now tie this with the trick of using a schema in the embedded database
other then public for the tables and an actual user name other then SA
and is about 5/8ths to having a Stand alone Base file for end users that
will keep them out of the actual tables accept via the defined form and
macro interfaces...
Then a little PublishBase wizard that takes an existing Base file and
makes the changes for that, maybe even create a default Switchboard form
and change the LoadDBForm to use that as a default if no form name is
passed..and it just might be something...
Ah - time to stop tinkering with Basic and spend a little time on an
actual design I think...
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]