Results 1 to 9 of 9
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Forms Collection issue! (Access 2000 SP2)

    This is DRIVING me nuts! For some reason, last few months, I can't figure this out. Whenever I try to use a Forms collection (Forms!frmxxx!xxx), I keep on getting an error message saying that it cannot find the form! I checked everything, the names is right, etc. Even if I follow examples from others, it still doesn't work. Please help. <img src=/S/ranton.gif border=0 alt=ranton width=66 height=37>

  2. #2
    Star Lounger
    Join Date
    Oct 2001
    Location
    Western Massachusetts, USA
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    Are the forms your looking for Open? They need to be open for the Collection to show them.

    HTH
    Paul

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    That was the oddest thing. I knew that subform has to be open for this to work. When I open the main form, I see the whole thing (Main form and subforms), so I assume it is "open"? Or is it defined differently? Can a subform that I can see on the main form be considered "closed"?

    Brent

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    A subform is NOT in the forms collection! Is is not considered an open form. To access a subform, you must reference it via the subform control name on the mainform (which may or may not be the same as the subform's name). Something like this:
    Forms!MainformName!subformControlname.Form!someCon trolName
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    I am not too sure what you mean by subformControlname.Form?

    Should I type: forms!frmA!fsubA!cboName

    OR

    forms!frmA!cboName.fsubA ?

    Thanks.

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    Let's use some examples. Let's say you have 2 forms in your database window: frmCustomers and frmPhones. Form frmPhones contains a textbox named txtPhoneNo. If you look on frmCustomers, you will see a subform control. That control has a Name property (which may be something like "subPhones") and a SourceObject property (which is the name of the actual form it contains, frmPhones). If you want to reference the Phone# on the current row in the subform, the complete syntax would be:
    Forms!frmCustomers!subPhones.Form!txtPhoneNo

    Which essentially says "Look in the Forms collection, find form frmCustomers, and on it find the control subPhones, then look at the Form it contains and find control txtPhoneNo".
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  7. #7
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Forms Collection issue! (Access 2000 SP2)

    In the latest versions of Access you can shortcut the reference by leaving out the ".form" part between the subform controlname and the control on the subform, giving you this:

    Forms!frmCustomers!subPhonestxtPhoneNo

    I believe in 97 you had to include it, but not in 2000 or later.
    Charlotte

  8. #8
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Forms Collection issue! (Access 2000 SP2)

    Yeah, I know that .Form is the default property for the subform control, and that I really don't have to use. However, I use still use it myself because I find it makes the code easier to read, and I use it when explaining the concept to other people because I think it helps them understand the relationship of the form within the subform control.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Forms Collection issue! (Access 2000 SP2)

    I really pointed it out because in A97, you *do* have to use it.
    Charlotte

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •