Results 1 to 6 of 6
  1. #1
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Manipulate closed forms (2000sp3)

    How can I manipulate properties for closed forms? I've tried using the properties of the allforms access object, in a variety of different ways, but it seems that although the online help suggests this collection contains both built in and user defined properties, using the following code to try and enumerate the properties produces no output (ie each form has no associated properties). Enumerating the contents of AllForms does behave as expected however.

    Dim obj As AccessObject, i As Integer, pty As AccessObjectProperty
    'On Error Resume Next
    For i = 1 To 20
    For Each pty In CurrentProject.AllForms(i).Properties
    Debug.Print CurrentProject.AllForms(i).Name; ":"; pty.Name
    Next pty
    Next i

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Manipulate closed forms (2000sp3)

    Are you trying to work in an ADP or an MDB database? You can do this with an MDB file using the Forms collection, but I've never tried to do it with an ADP.
    Wendell

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

    Re: Manipulate closed forms (2000sp3)

    That's DAO, Wendell. The AllForms collection is ADO-based. I saw the same behavior and I assume it is because ADO doesn't really know very much about Access objects. It is designed to handle data rather than interface objects.
    Charlotte

  4. #4
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Manipulate closed forms (2000sp3)

    That's what I suspected - and ADO in Access 2000 is pretty weak.
    Wendell

  5. #5
    Bronze Lounger
    Join Date
    Nov 2001
    Location
    Arlington, Virginia, USA
    Posts
    1,394
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Re: Manipulate closed forms (2000sp3)

    You can't loop thru the Properties collection of any of the AccessObject collections (such as AllForms) to reference the properties of indivdual objects, although you can reference the property by name directly. (I once wasted a lot of time trying to do so.) Example - instead of:

    Debug.Print CurrentData.AllTables(1).Properties("Name")

    Use:

    Debug.Print CurrentData.AllTables(1).Name

    This is explained (if you can call it an explanation) in MSKB Article 209788:

    ACC2000: Properties Collection Returns Error for CurrentProject and CurrentData Objects

    which provides the example above. Also provides usual lame MS "explanation": "This behavior is by design."

    HTH

  6. #6
    3 Star Lounger
    Join Date
    Feb 2001
    Posts
    369
    Thanks
    2
    Thanked 1 Time in 1 Post

    Re: Manipulate closed forms (2000sp3)

    They missed a bit: "This behaviour is by design and explicitly contradicts the information and examples given in Access 2000 online help". Which was presumably provided by accident.

    Thanks a lot mark, I'll see if I can work with that new information.

Posting Permissions

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