Henry Simpson
hsimpson88 at hotmail.com
Tue Oct 21 13:39:34 CDT 2003
Even worse, if you refresh the global while a procedure in the call stack uses the same global and there has been a change in the collections, you are open to some bizarre results. Running a Workspaces transaction in 97 seems to leave a previously initialized global database variable as an object but not pointing to a database. I had to rewrite a fair bit of old code when I started using transactions since I was getting errors from using a global database object. For my first couple of years with Access I was quite happy with a Global database variable, the performance it provided, and the fact that I didn't need to dimension, open, close and set to nothing in a great many procedures. I never did find out exactly why transactions caused me so much difficulty and it is possible it was merely because I didn't start with a separate database object. That experience did awaken my awareness of the potential consequences of nested procedures potentially resetting a variable alive and in use in another which is of course, the basis for most objections to Global variables. I never did finally determine the exact cause of the wayward database objects as I saw the advantage of circumventing the issue sooner than I could determine the cause. Hen >From: Gustav Brock <gustav at cactus.dk> >Reply-To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >To: Access Developers discussion and problem >solving<accessd at databaseadvisors.com> >Subject: Re: Betreft: RE: [AccessD] ..Performance ADO - DAO .. >Date: Tue, 21 Oct 2003 19:27:48 +0200 > >Hi Marty > > > You don't have to worry about anything at all. You will initialize > > the global variable only when you need to, and the reference > > returned will always be guaranteed to be accurate. > >Except when you make changes to, say, the TableDefs collection ... > >Using DBEngine(0)(0) all you need is a Refresh but with a static >dbCurrent you'll get toasted. > >/gustav _________________________________________________________________ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail