Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Massachusetts, USA
    Thanked 0 Times in 0 Posts

    Set Multiple Form Properties (2002 (XP))

    Is there any way I can select a bunch of forms and then set some properties for all of them at once? I neet to change about 30 of them to modal with some event commands that will be the same for each form and don't want to have to do it one at a time.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Set Multiple Form Properties (2002 (XP))

    Not form the user interface if what you had in mind was selecting a group of forms at once. You would have to write code to loop through the forms collection and make the changes. However, you could put the code in a public function in a standard module and call it from each of the forms or, if you are familiar with programming classes, you could create a form class with the event code in it and then bind each form to the class in its open event.

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Jerusalem, Israel
    Thanked 1 Time in 1 Post

    Re: Set Multiple Form Properties (2002 (XP))

    Here is some code that does this for all the forms in the database. I hope this is helpful


    Sub AllForms()
    Dim obj As AccessObject, dbs As Object
    Dim prp As Property
    Dim frm As Form

    Dim strName As String

    ' TO DO: Turn normal error handler on when this condition is finished.
    On Error Resume Next

    Set dbs = Application.CurrentProject
    ' Search for open AccessObject objects in AllForms collection.
    For Each obj In dbs.AllForms
    strName = obj.Name

    DoCmd.OpenForm strName, acDesign

    Set frm = Screen.ActiveForm
    'put in here any pfoperties that you would like to change.

    frm.SubdatasheetExpanded = False
    frm.OnError = "mcrSendError"
    DoCmd.Close acForm, strName, acSaveYes

    Next obj

    End Sub

Posting Permissions

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