ник: Lukas
Вот например функция из модуля библиотечной базы, которой я устанавливаю свойства форм, открытых в режиме конструктора.
Public Function funSetPropertyForm() 'открытых в режиме конструктора
' On Error Resume Next
Dim frm As Form
Dim ctrl As Control
Dim formName As String
For Each frm In Application.Forms
If frm.CurrentView = 0 Then
formName = frm.Name
frm.AllowDatasheetView = False
frm.AllowPivotChartView = False
frm.AllowPivotTableView = False
frm.NavigationButtons = False
frm.RecordSelectors = False
frm.DividingLines = False
frm.AutoCenter = True
frm.BorderStyle = 1
frm.AllowDesignChanges = False
frm.MinMaxButtons = 0
frm.ScrollBars = 0
frm.Section("ОбластьДанных").BackColor = 13690598
For Each ctrl In frm.Controls
If TypeOf ctrl Is CommandButton Then
' ctrl.FontName = "Tahoma"
ctrl.Width = 1020
ctrl.Height = 340
ctrl.FontSize = 8
ctrl.ForeColor = 16711680
ElseIf TypeOf ctrl Is Label Then
ctrl.FontName = "Tahoma"
ctrl.Height = 284
ctrl.FontSize = 10
ctrl.ForeColor = 16711680 '(синий)
ElseIf TypeOf ctrl Is TextBox Then
ctrl.FontName = "Tahoma"
ctrl.Height = 284
ctrl.FontSize = 10
ElseIf TypeOf ctrl Is ComboBox Then
ctrl.FontName = "Tahoma"
ctrl.FontSize = 10
ctrl.Height = 284
ElseIf TypeOf ctrl Is ListBox Then
ctrl.FontName = "Tahoma"
ctrl.FontSize = 10
ctrl.BackColor = 16252927
End If
Next ctrl
DoCmd.Save acForm, formName
MsgBox "Свойства формы '" & formName & "' установлены"
' DoCmd.Close acForm, formName, acSaveYes
End If
Next frm
End Function
|