• Manipulate closed forms (2000sp3)

    Author
    Topic
    #393554

    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

    Viewing 3 reply threads
    Author
    Replies
    • #715468

      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.

      • #715554

        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.

        • #715562

          That’s what I suspected – and ADO in Access 2000 is pretty weak.

        • #715563

          That’s what I suspected – and ADO in Access 2000 is pretty weak.

      • #715555

        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.

    • #715469

      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.

    • #715755

      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

      • #718663

        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.

      • #718664

        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.

    • #715756

      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

    Viewing 3 reply threads
    Reply To: Manipulate closed forms (2000sp3)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: