[AccessD] Loading more than one instance of a form

StaRKeY starkey at wanadoo.nl
Sun Jun 25 07:54:26 CDT 2006


John,

Is this what you're looking for?
You can open or change forms, reports, modules etc... Without them being
open!

Sub John
Dim doc as doa.document, db as dao.database

  Set db=Currentdb
  For each doc in db.containers("forms").documents
	debug.print doc.name
	docmd.open doc.name,acDesign,acHidden
	'do whatever you want in designmode
	docmd.close doc.name, True (save changes)
  Next doc
  Set db=nothing
  Set doc=nothing
End sub

Forms = forms
Reports = reports
Macro's = scripts
Modules = modules (moduletype ==> module or classmodule)

Regards,
Eric

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of JWColby
Sent: Sunday, June 25, 2006 2:40 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Loading more than one instance of a form

LOL, I meant:

someobject.somecollection("MyFormName")

Where SomeObject is some part of Access where the classes are stored...
And...

.somecollection is the collection of that object.

DAO gives you direct access to tables and queries (tabledefs and querydefs
collections), but forms and reports can only be gotten at directly when they
are open.  Somewhere there is a "documents" collection where the forms and
reports are stored in design view.  Modules and classes are a real PITA to
find, in fact AFAICT the only way to find them is to reference the VBA
editor and use properties of that.

John W. Colby
Colby Consulting
www.ColbyConsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Stuart McLachlan
Sent: Saturday, June 24, 2006 6:15 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Loading more than one instance of a form

On 24 Jun 2006 at 16:23, JWColby wrote:

> If you want to load a form you normally use docmd.open.  However it is 
> possible to use a set statement:
> 
> dim myform as form
> Set MyForm = new form_MyFormName
> 
> which is really setting a reference to the form's class.  Is there a 
> syntax to load it from a collection so that you could use a syntax 
> something like
> 
> set MyForm = new someobject.somecollection("MyFormName")
> 
> I have never been able to figure out how to do this but I thought I'd 
> ask the experts (you guys).
> 

That syntax should work, it you can actually get a collection of Forms and
not AccessObjects which happen to be forms.

How are you filling your collection?

--
Stuart


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



---
avast! Antivirus: Uitgaande bericht is niet besmet.
Virus Gegevensbestand (VPS): 0625-7, 23-06-2006
Getest op: 25-06-2006 14:54:27 uur
avast! auteursrecht (c) 1988-2006 ALWIL Software.
http://www.avast.com






More information about the AccessD mailing list