Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / December 2006

Tip: Looking for answers? Try searching our database.

Autexec to code

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gg - 02 Dec 2006 00:50 GMT
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.?
Allen Browne - 02 Dec 2006 01:28 GMT
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.

Signature

Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

>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.?
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.