Stuart McLachlan
stuart at lexacorp.com.pg
Sat Jun 24 21:26:27 CDT 2006
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