You can actually compile from within VBA code . . .
About a year ago, I was researching the traffic on my web site, and one thing led to another. I had re-entered the search terms that I originally used to find the information for my "lost folder" solution.
This was in the second link down. First link was to my web site. The compiling was incidental to what they were doing, which was replacing references.
I was looking over this information, and noticed that they were discussing pre-compile and post-compile issues. I wondered to myself how they were compiling, and low and behold, when I did a search on the page for the word compile, I found this:
appAccess.SysCmd 504, 16483 '<- undocumented call for Compile All without a module open
See following page to find this:
http://bytes.com/topic/access/answer...rary-reference
A little research yields:
SysCmd(504, Flag) - COMPILE VBA MODULES
Where flag can be 16483 to indicate 'Save VBA with compiled code' or 16484 for 'Save VBA without compiled code'.
Flag can also be 16481 and 16482 but the functionality is unknown at present.
and:
http://support.microsoft.com/kb/323203
At first, I was thinking in terms of using this to make MDEs and ADEs. I slowly realized, however, that it might not help for that. It does, however, solve the problem that I had with apparently broken references after changing the references in MDBs.
I had previously solved that problem by making sure to explicitly delete the reference to the published version of the program on the network (the one that was available to the public for download). I then re-added the reference at run-time, with a new one pointing to the library in the users home folder.
Now, I should be able to dispense with doing reference changing at run time, and may be able to just make sure that the network master gets recompiled after it has been published.
Also, see my method for getting compiled Access programs to find references at run time:
http://www.mooresw.com/get_ms_access...piled_code.php
Later,
Bruce