以下代码实现对当前数据库中窗体的遍历,和属性修改.
Sub Setforms()
Dim fm As AccessObject
For Each fm In CurrentProject.AllForms
DoCmd.Openform fm.Name, acDesign
With Forms(fm.Name)
.AllowEdits = False
.AllowDatasheetView = False
.AllowAdditions = False
.AllowDeletions = False
.AllowFilters = False
.AllowLayoutView = False
.AllowPivotChartView = False
.AllowPivotTableView = False
.ScrollBars = 0
.BorderStyle = 1
.MinMaxButtons = 1
.RecordSelectors = False
.NavigationButtons = False
End With
DoCmd.Close acForm, fm.Name, acSaveYes
Next
End Sub