Macro from protected library not firing

Win10 LO 6.7.2 HSQL 2.5

Hello

Working with password protected library at times macros don’t fire as anticipated, attached link to split dB
for demonstration.

pw module sm12 pw is winzi contains sub test

Standard-Embedded Setup line 78 loads sm12 library
line 82 calls normal macro which fires ok
line 84 calls test but does not fire whereas line 85 calls
DBOpen which does fire

test attached to Form1 doc open event works

Have no idea what’s happening here.

Link File on MEGA

Hello,

The problem is being created by a Function. It has nothing to do with protected code. Have seen this in both Basic and Python code. Certain items don’t seem to complete until an entire process is finished when a Function is used within the code. This occurs in your code when you call Install_HSQLDB which calls the function isInstalled().

Also use this to load your library:

If Not BasicLibraries.isLibraryLoaded("sm12") then
    ThisComponent.BasicLibraries.loadLibrary("sm12")
Endif

So here is how I got all to work. Created small macro only to load libraries and attached to Open Document event of Base. Moved the Setup code to the protected sm12 module for testing. Attached this to the View Created event of Base. Saved Base. Opened Base and all worked.

So two events were fired off when Base was opened. Document opened and library loaded; View created and protected code was executed.

Again, this has nothing to do with protected code. The same holds true if not set with password.

Some further testing shows that even calling another sub created a problem and not just the function. So load libraries in a single sub from a Standard library. In testing did this with Open Document event loading library then rest of code from other library in View Created event. After that you should have access.

@Ratslinger
Marvelous, working thank you!

@gkick,

Glad all is OK. Samples help a lot!

BTW you clicked check mark twice. Answer still not accepted.

Thank You.