Results 1 to 3 of 3
  1. #1
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694

    Global Property Changes


    The following function will change specified properties on all forms in the database:

    Code:
    Function PropChanges()
    
    '******************************************************************************
    '_____________________________________________________________________________*
    '                                                                             |
    'RUN AT YOUR OWN RISK!  THIS FUNCTION OPENS EVERY FORM IN THE DATABASE AND    |
    'REPLACES PROPERTY SETTINGS.  30 FORMS TAKES APPROXIMATELY 5 SECONDS.         |
    'IT IS RECOMMENDED TO BACKUP YOUR DATABASE BEFORE RUNNING THIS FUNCTION.      |
    '_____________________________________________________________________________|
    '                                                                             *
    'Author: Adam Evanovich                                                       *
    'Date: 10/15/2010                                                             *
    'Purpose: To change a form property or properties on all forms.               *
    '                                                                             *
    'Arguments: None                                                              *
    '                                                                             *
    'ENUMERATION VALUES                                                           *
    '-----------------------------------------------------------------------------*
    'DefaultView: Single = 0            PictureType: Embedded = 0                 *
    '             Continuous = 1                     Linked = 1                   *
    '             Datasheet = 2                                                   *
    '             PivotTable = 3                                                  *
    '             PivotChart = 4                                                  *
    '             Split = 5                                                       *
    '                                                                             *
    'PictureAlignment: Top Left = 0     PictureSizeMode: Clip = 0                 *
    '                  Top Right = 1                     Stretch = 1              *
    '                  Center = 2                        Zoom = 2                 *
    '                  Bottom Left = 3                   Stretch Horizonal = 3    *
    '                  Bottom Right = 4                  Stretch Vertical = 4     *
    '                  Form Center = 5                                            *
    '                                                                             *
    'BorderStyle: None = 0              ScrollBars: Neither = 0                   *
    '             Thin = 1                          Horizontal = 1                *
    '             Sizable = 2                       Vertical = 2                  *
    '             Dialog = 3                        Both = 3                      *
    '                                                                             *
    'MinMaxButtons: None = 0            RecordsetType: Dynaset = 0                *
    '               Min = 1                            Snapshot = 2               *
    '               Max = 2                                                       *
    '               Both = 3                                                      *
    '                                                                             *
    'RecordLocks: None = 0              Cycle: All Records = 0                    *
    '             All Records = 1              Current Record = 1                 *
    '             Edited Record = 2            Current Page = 2                   *
    '                                                                             *
    '******************************************************************************
    
    On Error GoTo Err_Handle
    
    Dim i As Integer
    Dim j As Long
    
        For i = 0 To CurrentProject.AllForms.Count - 1
            DoCmd.OpenForm CurrentProject.AllForms(i).Name, acDesign
    
                For j = 0 To 500000
                Next j
    
                   With Forms(i)
                      'DELETE PROPERTIES NOT BEING ALTERED
                      .Caption = "STRING"
                      .DefaultView = ENUMERATED
                      .AllowDatasheetView = False / True
                      .AllowFormView = False / True
                      .AllowLayoutView = False / True
                      .AllowPivotChartView = False / True
                      .AllowPivotTableView = False / True
                      .Picture = "PATH"
                      .PictureType = ENUMERATED
                      .PictureTiling = False / True
                      .PictureAlignment = ENUMERATED
                      .PictureSizeMode = ENUMERATED
                      .Width = "TWIPS" '1,440 TWIPS = 1 INCH
                      .AutoCenter = False / True
                      .AutoResize = False / True
                      .FitToScreen = False / True
                      .BorderStyle = ENUMERATED
                      .RecordSelectors = False / True
                      .NavigationButtons = False / True
                      .NavigationCaption = "STRING"
                      .DividingLines = False / True
                      .ScrollBars = ENUMERATED
                      .ControlBox = False / True
                      .MinMaxButtons = ENUMERATED
                      .CloseButton = False / True
                      .Moveable = False / True
                      .RecordSource = "SQL STRING"
                      .RecordsetType = ENUMERATED
                      .FetchDefaults = False / True
                      .Filter = "FILTER STRING"
                      .FilterOnLoad = False / True
                      .OrderBy = "ORDER BY STRING"
                      .OrderByOnLoad = False / True
                      .DataEntry = False / True
                      .AllowAdditions = False / True
                      .AllowDeletions = False / True
                      .AllowEdits = False / True
                      .AllowFilters = False / True
                      .RecordLocks = ENUMERATED
                      .PopUp = False / True
                      .Modal = False / True
                      .Cycle = ENUMERATED
                      .ShortcutMenu = False / True
                   With Forms(i)
                
                For j = 0 To 500000
                Next j
    
        Next i
    
        For i = 0 To CurrentProject.AllForms.Count - 1
            DoCmd.Close acForm, CurrentProject.AllForms(i).Name, acSaveYes
                For j = 0 To 500000
                Next j
        Next i
    
    Exit_Handle:
        Exit Function
    
    Err_Handle:
        MsgBox Err.Description
            GoTo Exit_Handle
    
    End Function

  2. #2
    HiTechCoach's Avatar
    HiTechCoach is offline MS MVP - Access Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jul 2010
    Location
    Oklahoma, USA
    Posts
    702
    Quote Originally Posted by ajetrumpet View Post
    The following function will change specified properties on all forms in the database:

    Code:
    Function PropChanges()
     
    '******************************************************************************
    '_____________________________________________________________________________*
    '                                                                             |
    'RUN AT YOUR OWN RISK!  THIS FUNCTION OPENS EVERY FORM IN THE DATABASE AND    |
    'REPLACES PROPERTY SETTINGS.  30 FORMS TAKES APPROXIMATELY 5 SECONDS.         |
    'IT IS RECOMMENDED TO BACKUP YOUR DATABASE BEFORE RUNNING THIS FUNCTION.      |
    '_____________________________________________________________________________|
    '                                                                             *
    'Author: Adam Evanovich                                                       *
    'Date: 10/15/2010                                                             *
    'Purpose: To change a form property or properties on all forms.               *
    '                                                                             *
    'Arguments: None                                                              *
    '                                                                             *
    'ENUMERATION VALUES                                                           *
    '-----------------------------------------------------------------------------*
    'DefaultView: Single = 0            PictureType: Embedded = 0                 *
    '             Continuous = 1                     Linked = 1                   *
    '             Datasheet = 2                                                   *
    '             PivotTable = 3                                                  *
    '             PivotChart = 4                                                  *
    '             Split = 5                                                       *
    '                                                                             *
    'PictureAlignment: Top Left = 0     PictureSizeMode: Clip = 0                 *
    '                  Top Right = 1                     Stretch = 1              *
    '                  Center = 2                        Zoom = 2                 *
    '                  Bottom Left = 3                   Stretch Horizonal = 3    *
    '                  Bottom Right = 4                  Stretch Vertical = 4     *
    '                  Form Center = 5                                            *
    '                                                                             *
    'BorderStyle: None = 0              ScrollBars: Neither = 0                   *
    '             Thin = 1                          Horizontal = 1                *
    '             Sizable = 2                       Vertical = 2                  *
    '             Dialog = 3                        Both = 3                      *
    '                                                                             *
    'MinMaxButtons: None = 0            RecordsetType: Dynaset = 0                *
    '               Min = 1                            Snapshot = 2               *
    '               Max = 2                                                       *
    '               Both = 3                                                      *
    '                                                                             *
    'RecordLocks: None = 0              Cycle: All Records = 0                    *
    '             All Records = 1              Current Record = 1                 *
    '             Edited Record = 2            Current Page = 2                   *
    '                                                                             *
    '******************************************************************************
     
    On Error GoTo Err_Handle
     
    Dim i As Integer
    Dim j As Long
     
        For i = 0 To CurrentProject.AllForms.Count - 1
            DoCmd.OpenForm CurrentProject.AllForms(i).Name, acDesign
     
                For j = 0 To 500000
                Next j
     
                   With Forms(i)
                      'DELETE PROPERTIES NOT BEING ALTERED
                      .Caption = "STRING"
                      .DefaultView = ENUMERATED
                      .AllowDatasheetView = False / True
                      .AllowFormView = False / True
                      .AllowLayoutView = False / True
                      .AllowPivotChartView = False / True
                      .AllowPivotTableView = False / True
                      .Picture = "PATH"
                      .PictureType = ENUMERATED
                      .PictureTiling = False / True
                      .PictureAlignment = ENUMERATED
                      .PictureSizeMode = ENUMERATED
                      .Width = "TWIPS" '1,440 TWIPS = 1 INCH
                      .AutoCenter = False / True
                      .AutoResize = False / True
                      .FitToScreen = False / True
                      .BorderStyle = ENUMERATED
                      .RecordSelectors = False / True
                      .NavigationButtons = False / True
                      .NavigationCaption = "STRING"
                      .DividingLines = False / True
                      .ScrollBars = ENUMERATED
                      .ControlBox = False / True
                      .MinMaxButtons = ENUMERATED
                      .CloseButton = False / True
                      .Moveable = False / True
                      .RecordSource = "SQL STRING"
                      .RecordsetType = ENUMERATED
                      .FetchDefaults = False / True
                      .Filter = "FILTER STRING"
                      .FilterOnLoad = False / True
                      .OrderBy = "ORDER BY STRING"
                      .OrderByOnLoad = False / True
                      .DataEntry = False / True
                      .AllowAdditions = False / True
                      .AllowDeletions = False / True
                      .AllowEdits = False / True
                      .AllowFilters = False / True
                      .RecordLocks = ENUMERATED
                      .PopUp = False / True
                      .Modal = False / True
                      .Cycle = ENUMERATED
                      .ShortcutMenu = False / True
                   With Forms(i)
     
                For j = 0 To 500000
                Next j
     
        Next i
     
        For i = 0 To CurrentProject.AllForms.Count - 1
            DoCmd.Close acForm, CurrentProject.AllForms(i).Name, acSaveYes
                For j = 0 To 500000
                Next j
        Next i
     
    Exit_Handle:
        Exit Function
     
    Err_Handle:
        MsgBox Err.Description
            GoTo Exit_Handle
     
    End Function

    About:
    Code:
                For j = 0 To 500000
                Next j
    Why do you you have all these loops?

  3. #3
    rmadera is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2012
    Posts
    1
    I am in the learning process for Access 2010. I have a question. I paste the code above, but in the debug, compile show an error as follow:

    For J = 0 To 500000
    Next J

    Next I (shadowed this instruction and show the message Compile error Next without For)

    For I = 0 To CurrentProject.AllForms.Count - 1
    DoCmd.Close acForm, CurrentProject.AllForms(I).NAME, acSaveYes
    For J = 0 To 500000
    Next J

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

Similar Threads

  1. the property is read only and cannot be set
    By darksniperx in forum Access
    Replies: 16
    Last Post: 11-02-2012, 02:48 PM
  2. Create Property
    By RAPSR in forum Programming
    Replies: 2
    Last Post: 10-12-2010, 12:39 AM
  3. Can Grow Property
    By chum in forum Reports
    Replies: 3
    Last Post: 01-25-2010, 11:10 AM
  4. Can Grow Property
    By MFeightner in forum Reports
    Replies: 0
    Last Post: 06-24-2009, 11:50 AM
  5. 'On Open' Property
    By emilylu3 in forum Forms
    Replies: 1
    Last Post: 12-08-2005, 02:28 PM

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