Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    forms not recognized (2002)

    I have an access database with a bunch of hidden forms and 1 visible one. In code, the Forms collection only recognizes the existence of the visible form. I created another form, made it visible, and still, the Forms collection won't recognize it. However, if I use DoCmd.OpenForm with the name of this form, it will open. How can I get the forms collection to recognize it so that I can manipulate its properties in code?

  2. #2
    3 Star Lounger
    Join Date
    May 2002
    Location
    Toronto, Ontario, Canada
    Posts
    314
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: forms not recognized (2002)

    Whether the forms are visible or hidden is irrelevant... The Forms Collections only recognizes forms that are currently Open... If you want to manipulate the forms properties by code, you'll have to (I believe...) open the form (visible or invisible as needed) before doing what you need to do...

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

    Re: forms not recognized (2002)

    The forms collection applies to open forms, not those in the database window. If you post the code you're trying to use someone will be able to help you straighten it out. Access 2002 has an AllForms collection, which is not the same as the Forms collection, and you can loop through the AllForms collection and using DAO through the forms container, so please let us know the details.
    Charlotte

  4. #4
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: forms not recognized (2002)

    Before opening the form that I call "General Form", I want to change some of its properties by using code like this:
    forms("General Form").DataEntry = False
    I then want to open the form using DoCmd.OpenForm "General Form" (or whatever else works).

  5. #5
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: forms not recognized (2002)

    I just tried the AllForms collection. It does contain my form ('general form'), but provides very limited access to it. How do I use this handle on my form to change things such as the DAtaEntry property?

  6. #6
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: forms not recognized (2002)

    Thanks for letting me know that the Forms collection only contains open forms. With this knowledge, I came up with a workaround that I can live with. I change the properties of the form after opening it. It all happens so quickly that the user is not aware of it.

  7. #7
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: forms not recognized (2002)

    An alternative is to use the DataMode argument of DoCmd.OpenForm; this can be set to acFormEdit, acFormAdd and acFormReadOnly. If you omit it, the form will use the settings from the Properties window. Look up OpenForm in the VBA help for details.

  8. #8
    2 Star Lounger
    Join Date
    Oct 2002
    Location
    Lakewood, New Jersey, USA
    Posts
    187
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: forms not recognized (2002)

    Thanks, Hans. The datamode argument would help me for the DAtaEntry property, but not for the other ones that I wanted to change e.g. NavigationButtons.

Posting Permissions

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