🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.databases.ms-access
Article #27

Re: quick question on Database Variables

#27
From: Haha
Date: Tue, 15 Sep 1998 00:00
90 lines
3312 bytes
First: try compacting and repairing your database. This might help, although
you may have thought of that yourself (but didn't mention it). Remember that
while editing forms, making reports the file will also grow!

Second: I always use new variables in the procedures if I need a reference
to the currentdb(). If you do a .close of that object there's nothing wrong.
Because you use the SET syntax, you only get a reference. It's no big deal
really.

SO:

sub myProc()
  dim db as database

  set db=currentdb()

 ..... other stuff

  db.close
end sub

No problem.
--
Martin.MolemaPC800@pbc.be.philips.com.PC800

NOSPAM
Remove the PC800 from the e-mail.
----------------------------------------------------------------------------
----------------
When a broken tool is demonstrated before the repairman
It will work perfectly.
----------------------------------------------------------------------------
----------------

Anthony wrote in message <6th9sq$g6ck$1@newssvr04-int.news.prodigy.com>...
>Hello all,
>I hope someone can answer my question regarding Database variables - I
would
>appreciate it!
>
>I created an Access application with one Main Form and several Subforms
>within it.
>There are several modules with code.
>
>In a General Declarations section of one of my Modules, I have the
following
>code:
>
>Public dbsName as database
>Public wrkName as Workspace
>
>In the On_Load event of the Main Form (i.e. when the application "starts"),
>I have the following code:
>
>    Set dbsName = CurrentDb
>    Set wrkName = DBEngine.Workspaces(0)
>
>There are hundreds of instances when this Database Variable  - dbsName - is
>invoked.  I thought it would be best to Set it when the Main Form opens.
>
>Unfortunately, though, I am having two problems:
>1.  Whenever I leave the Main Form (a Massage Box pops pop, thus Focus
being
>transferred from MainForm to something else..) .. whenever this happens and
>the program tries to execute a line with the database variable in it, it
>creates an 'Object Not Defined" error.
>
>So, my question is:   WHEN (and how often), should the database variable be
>Set and/or defined ??
>
>
>2.  My other simple question is this:
>My database is EXPLODING in size, despite the fact that I am neither adding
>more data to any of the tables and not adding anything else to the
database.
>It will, for example, go from 3 MB to 4 MB just by opening it and closing
>it.
>
>WHAT IS UP WITH THAT??
>
>
>Thank you for your time and help!!
>Please send comments to:
>anv@prodigy.net    AND   anthony.verrecchia@fmr.com
>
>Thanks!
>
>
>
>
Technical Details
Message-ID: <905863847.214826@nlt185.pbc.be.philips.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6th9sq$g6ck$1@newssvr04-int.news.prodigy.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1668c5,b54851c7c6e6c49d
X-Google-Attributes: gid1668c5,public
X-Google-Thread: ff0ac,867b400e6c187fa8
X-Google-Attributes: gidff0ac,public
From: "Haha" <no.Spam@for.Everyone>
Subject: Re: quick question on Database Variables
Date: 1998/09/15
Message-ID: <905863847.214826@nlt185.pbc.be.philips.com>
X-Deja-AN: 391330727
Cache-Post-Path: nlt185.pbc.be.philips.com!unknown@130.139.41.8
References: <6th9sq$g6ck$1@newssvr04-int.news.prodigy.com>
Organization: More haha
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4
Newsgroups: comp.databases.ms-access,at.fido.msaccess