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