Autexec to code

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to convert my database program to a run time program. From what
I have read here, all macros must go and be replaced by code before
conveting. This has been easy until i get top the autoexc macro. Is there a
way or do I have to have the opening form do the job.?
 
Macros work in runtime. The problem is that they have no error handling (at
least not before A2007 anyway), and so if any error occurs, the runtime
shuts down. Therefore it's not really safe to do do much more than Beep in a
macro.

But you can use RunCode to call a function. Therefore you can create a
function do do your initialization, and use the AutoExec macro to call the
function.

An alternative is to specify a startup form under Tools | Startup, and use
the Open event of that form to do your initialization. If your database is
split, part of the init process will be to check that the back end is
available. If you plan to do this in the open event of a form, the form
needs to be unbound: otherwise it will error before you get to run your
checks. So you may end up with a fake form that is unbound and does nothing
but run your init code. You then cancel the open of this fake form, and
either quit (if the data is not present) or open your real switchboard/main
form.
 
Back
Top