In Access, is possible to change one property in several reports/forms at once?

S C 0 Reputation points
2023-02-24T21:50:27.6433333+00:00

I have an application with 163 reports. I need to change the property to Pop Up = Yes in each report.

Is there a way to do the change in al reports at once? Or I need to open each report and change the property, save and close.

Sc

Access
Access
A family of Microsoft relational database management systems designed for ease of use.
334 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Alan Farias 750 Reputation points
    2023-02-24T23:41:45.6066667+00:00

    It is possible to change one property in several reports/forms at once in Access using VBA code. Here is an example of VBA code that can be used to set the Pop Up property to Yes for all reports:

    Sub SetPopUpProperty()
    
        Dim obj As AccessObject
        Dim rpt As Report
        
        For Each obj In CurrentProject.AllReports
            Set rpt = obj
            rpt.PopUp = True
            rpt.Save
        Next obj
        
    End Sub
    

    To use this code, open the VBA editor in Access by pressing Alt+F11, create a new module, and paste the code above into the module. Then, run the SetPopUpProperty subroutine and it will loop through all reports in the current database and set the PopUp property to Yes.

    Note that this code will also save each report after the PopUp property is changed. If you want to modify forms instead of reports, you can modify the code accordingly by changing the "AllReports" property to "AllForms" and changing the variable type of "rpt" to "Form".