Ask Your Question

Macro from protected library not firing

asked 2021-01-09 06:59:44 +0100

gkick gravatar image

Win10 LO 6.7.2 HSQL 2.5


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.


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2021-01-09 21:31:34 +0100

Ratslinger gravatar image


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

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.

edit flag offensive delete link more


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 gravatar imageRatslinger ( 2021-01-09 22:26:33 +0100 )edit

@Ratslinger Marvelous, working thank you!

gkick gravatar imagegkick ( 2021-01-09 22:57:14 +0100 )edit


Glad all is OK. Samples help a lot!

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

Thank You.

Ratslinger gravatar imageRatslinger ( 2021-01-09 23:07:40 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2021-01-09 06:59:44 +0100

Seen: 19 times

Last updated: Jan 09