Results 1 to 9 of 9
  1. #1
    soncci is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    3

    How to change one or more properties in several reports or forms at once

    I have an application with 163 forms.
    I need to change the properties to Pop Up = Yes, Auto Resize = No and Fit To Screen = No, in each form.



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

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Open each form, change, save.

    Could program VBA procedure to do it.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    Is there a way to do the change in al forms at once? No, not really.

    Or I need to open each form and change the property, save and close. Yes, but can do so with code instead of manually. You could research how to loop over the forms collection.

    Usually when someone says they have a huge number of forms/reports in a db I imagine that many of them are just minor variations. Having a form for records that are to be view only in one situation and editable or for adding in another is not the way to go. Same for reports: not one for sales for group1 for Jan and 1 for group2 for Jan and so on. Maybe that's not the case here
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    soncci,

    As others have suggested, you could do this using code. However, micron offered some thoughts on your various forms and usage that you might want to comment on. It would help put some context on your requirement.

  5. #5
    soncci is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    3
    Quote Originally Posted by orange View Post
    soncci,

    As others have suggested, you could do this using code. However, micron offered some thoughts on your various forms and usage that you might want to comment on. It would help put some context on your requirement.
    Thank you for the replies.

    I need a code to change the same property (or properties) for ALL my reports or ALL my forms.

    The application is already builded so just need help with the code.

    From another forum I got the following:

    Sub SetPopUpProperty()

    Dim obj As AccessObject
    Dim rpt As Report

    For Each obj In CurrentProject.AllReports
    If obj.Type = acReport Then 'check if the object is a report
    Set rpt = obj
    rpt.PopUp = True
    rpt.Save
    End If
    Next obj

    End Sub


    I copied and run the module from the VBA editor but


    I get the following error:


    Run-time error '13' Type mismatch


    When I debug it highlight the " Set rpt = obj "

  6. #6
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    Looks like cross posted here with an unacknowledged posted solution 5 days ago.
    https://learn.microsoft.com/en-us/an...property-in-se

    @soncci - great way to get on somebody's ignore list.
    Good luck.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    soncci is offline Novice
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    3
    Quote Originally Posted by Micron View Post
    Looks like cross posted here with an unacknowledged posted solution 5 days ago.
    https://learn.microsoft.com/en-us/an...property-in-se

    @soncci - great way to get on somebody's ignore list.
    Good luck.
    WOW! Thank you! for your help.

  8. #8
    Micron is online now Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,422
    You're quite welcome.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    This worked for me:
    Code:
    Sub SetPopUpProperty()
    
    Dim obj As Object
    Dim rpt As String
    
    
    For Each obj In CurrentProject.AllReports
    If obj.type = acReport Then 'check if the object is a report
        rpt = obj.Name
        DoCmd.OpenReport rpt, acViewDesign
        Reports(rpt).Properties("PopUp").Value = True
        DoCmd.Close acReport, rpt, acSaveYes
    End If
    Next obj
    
    
    End Sub
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 05-18-2021, 01:46 AM
  2. Replies: 18
    Last Post: 02-22-2021, 05:25 PM
  3. Replies: 3
    Last Post: 09-21-2017, 07:02 AM
  4. Replies: 1
    Last Post: 07-03-2014, 10:45 AM
  5. Change properties of a text box
    By GraeagleBill in forum Reports
    Replies: 5
    Last Post: 08-29-2013, 11:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums