[AccessD] Loading more than one instance of a form

JWColby jwcolby at colbyconsulting.com
Sun Jun 25 07:45:58 CDT 2006


>Hence my question "How are you filling *your* collection?".  You would need
to somehow create a Forms collection first :-( 

I'm not filling my collection, I do not even have a collection (yet).  I am
trying to open forms using a 

Set MyFormPointer=SomeExistingAccessCollection("MyFormName")

Syntax.  That is the whole point of this thread.

I want to be able to pass in the name of a form to a function and open that
form.  This can be done for the FIRST instance of the form, but if you want
to open the form more than one time, you have to use a syntax of 

Set MyFormInstance = new form_MyFormName

Which means HARD CODING that line of code.

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 10:26 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Loading more than one instance of a form

On 24 Jun 2006 at 20:40, JWColby wrote:

> 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.

Depends on what you mean by "gotten at". You can reference the AccessObjects
which represent these forms and do things like this:

Function ShowForms()
  Dim obj As AccessObject
  For Each obj In CurrentProject.AllForms
      Debug.Print obj.Name
  Next
End Function

but I agree,  there is no built in collection of Form objects - nor of any
other Classes, be they built in or application specific.  

The difference between Tables/Queries and Forms/Reports is that the first
are  collections of tabledef/querydef objects within a Database object 
whilst   AllForms/Reports/AllModules etc are collections of AccessObjects 
within a Project object.

> Somewhere there is a "documents" collection where the forms and 
> reports are stored in design view.

I very much doubt that there actually is such a Collection. There are just
separate collections of AccessObjects for each type of object
(AllDataAccessPages,AllForms,AllReports,AllModules etc).  Since one of the
properties of an AccessObject is Type, it makes you wander why they don't
have a single collection of all objects ?

So, coming back to your original question, there doesn't seem to be a "Forms
collection" that you can instantiate a new Form from, hence my question.
Hence my question "How are you filling *your* collection?".  You would need
to somehow create a Forms collection first :-(



--
Stuart


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




More information about the AccessD mailing list