Setting a subform to a member of a collection

Discussion in 'Access VBA Modules' started by Dennis Snelgrove, Jun 2, 2010.

  1. I'm attempting to write a class module that will act as a multiple
    subform manager.
    I've got a form in Access 2007 which has a large empty subform
    container, a list box, and a set of command buttons for opening up a
    couple of types of subforms and doing a couple of other things. The
    subform is simply a holder for the currently active form; in no case
    is there any need for a parent/child relationship. The idea is that
    this database is an event log and we have a couple of different
    subforms that we use to record different types of events during a work
    shift. I need to be able to open up more than one entry at the same
    time as there are times when we have more than one event happening
    concurrently. I want the manager to use the listbox to show the
    currently open entries; click on an entry in the list box and it
    brings (or switches) that form into the subform container, while not
    closing any other subform that may still be open. All subforms have a
    "Save" button on them for saving the individual entry.

    In the General Declarations area of the class module, I declare :
    Dim clnOpenSubForms As New Collection
    Private lstOpenSubForms As ListBox
    Private chldSubFormContainer As SubForm

    I store a form in clnOpenSubForms with a key of "CStr(hWnd)" The list
    box and the subform are properties of the class, telling it what
    control to use on the form. My problem is that I can't figure out how
    to set the chldSubFormContainer to an entry in the collection. I know
    I'd do this in the list box update event procedure, but how to do is
    where I'm confused.

    Any help is appreciated...
     
    Dennis Snelgrove, Jun 2, 2010
    #1
    1. Advertisements

  2. Dennis Snelgrove

    Alex Dybenko Guest

    Hi,
    as I understand you - try:

    strKey=CStr(hWnd) ' set the key to appropriate value

    Set chldSubFormContainer = clnOpenSubForms(strKey)

    --
    Best regards,
    ___________
    Alex Dybenko (MVP)
    http://accessblog.net
    http://www.PointLtd.com


    "Dennis Snelgrove" <> wrote in message
    news:...
    > I'm attempting to write a class module that will act as a multiple
    > subform manager.
    > I've got a form in Access 2007 which has a large empty subform
    > container, a list box, and a set of command buttons for opening up a
    > couple of types of subforms and doing a couple of other things. The
    > subform is simply a holder for the currently active form; in no case
    > is there any need for a parent/child relationship. The idea is that
    > this database is an event log and we have a couple of different
    > subforms that we use to record different types of events during a work
    > shift. I need to be able to open up more than one entry at the same
    > time as there are times when we have more than one event happening
    > concurrently. I want the manager to use the listbox to show the
    > currently open entries; click on an entry in the list box and it
    > brings (or switches) that form into the subform container, while not
    > closing any other subform that may still be open. All subforms have a
    > "Save" button on them for saving the individual entry.
    >
    > In the General Declarations area of the class module, I declare :
    > Dim clnOpenSubForms As New Collection
    > Private lstOpenSubForms As ListBox
    > Private chldSubFormContainer As SubForm
    >
    > I store a form in clnOpenSubForms with a key of "CStr(hWnd)" The list
    > box and the subform are properties of the class, telling it what
    > control to use on the form. My problem is that I can't figure out how
    > to set the chldSubFormContainer to an entry in the collection. I know
    > I'd do this in the list box update event procedure, but how to do is
    > where I'm confused.
    >
    > Any help is appreciated...
     
    Alex Dybenko, Jun 2, 2010
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Casey

    Asking if User Is Member of Group Using Code

    Casey, Sep 10, 2003, in forum: Access VBA Modules
    Replies:
    3
    Views:
    65
    Casey
    Sep 10, 2003
  2. Carl Schuster

    methode or data member not found

    Carl Schuster, Dec 1, 2003, in forum: Access VBA Modules
    Replies:
    3
    Views:
    97
    Carl Schuster
    Dec 2, 2003
  3. helegua

    Running Total per member table

    helegua, Apr 28, 2004, in forum: Access VBA Modules
    Replies:
    2
    Views:
    81
    Helegua
    Apr 28, 2004
  4. Matthew DeAngelis

    Method or Data Member Not Found, but definitely there

    Matthew DeAngelis, Aug 11, 2004, in forum: Access VBA Modules
    Replies:
    3
    Views:
    142
  5. Tcs
    Replies:
    1
    Views:
    111
  6. LisaB

    Method or Data member not found

    LisaB, Oct 14, 2004, in forum: Access VBA Modules
    Replies:
    1
    Views:
    123
    Ken Snell [MVP]
    Oct 14, 2004
  7. toolsgg
    Replies:
    3
    Views:
    84
    David C. Holley
    Jul 15, 2005
  8. Kat
    Replies:
    5
    Views:
    191
Loading...