[AccessD] Loading more than one instance of a form

Mark A Matte markamatte at hotmail.com
Mon Jun 26 13:58:11 CDT 2006


JC...not sure if anyone mentioned...or if you knew...or if I even know 
exactly what you are looking for...but in the A97 version of Solution.mdb 
there are step by step instructions for creating/viewing/referencing 
multiple instances of a form???

Is this what you're looking for?

Mark A. Matte


>From: "JWColby" <jwcolby at colbyconsulting.com>
>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: [AccessD] Loading more than one instance of a form
>Date: Sun, 25 Jun 2006 09:36:11 -0400
>
>Eric,
>
>This is what I meant when I said that there was a document collection
>somewhere.  I used to use this syntax when I built a widget for working on
>forms in design view.  Unfortunately, that does not solve the problem of
>getting a handle to the form opened.
>
>If you run Docmd.Open doc.name ONCE then you can get a handle to that form
>using currentdb.forms("FormNameJustOpened").  Unfortunately if you open the
>same form several times using that same syntax,
>
>Docmd.Open doc.name
>Set MyFormPointer1=currentdb.forms("FormNameJustOpened")
>Docmd.Open doc.name
>Set MyFormPointer2=currentdb.forms("FormNameJustOpened")
>
>Does not work
>
>Apparently the forms all go into the currentdb.forms() collection, but
>because they all have the same name, the second instance cannot be
>retrieved.  Or perhaps the second instance is never instanced at all?  I
>have never actually looked at currentdb.forms().count to see if the second
>and subsequent instance ever actually makes it into that collection.
>
>In any event I can't get a pointer to the second and subsequent form
>instance which is my objective.
>
>I can open multiple instances till the cows come home using
>Dim MyFormCollection as collection
>While 1
>	Set MyFormPointer = form_MyFormName
>	MyFormCollection.Add MyFormPointer
>Wend
>
>BUT...
>
>Set MyFormPointer = form_MyFormName
>
>Means I have hardcoded the set statement to the name of ONE SPECIFIC FORM
>form_MyFormName
>
>The reason I am trying to do this is that (for example) if you had a bunch
>of list tables consisting of a PK and a field (CI_ID, CI_CityName)...
>
>You could build a single list form, open that form, change the recordsource
>and bind the controls to the two fields, whatever they may be.  Thus you
>could be have one form for every list table with just two fields instead of
>a new form for each.
>
>That is just one example of where this would be useful.
>
>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 StaRKeY
>Sent: Sunday, June 25, 2006 8:54 AM
>To: 'Access Developers discussion and problem solving'
>Subject: Re: [AccessD] Loading more than one instance of a form
>
>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
>
>--
>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