我一直在努力改变所有形式的设计。为此,我创建了一个函数,它打开每个表单,执行更改,然后保存并关闭它。我可以使用ControlType更改访问它的每个控件,但我不知道如何访问和执行表单背景颜色的更改。 我尝试了一些方法,但没有成功,我试过了 me.formheader.backcolor 甚至 CurrentDb.Containers( “形式”)。文件(J).backcolor 我想这样做(我为一种形式做过):
Me.FormHeader.BackColor = RGB(225, 225, 255)
Me.FormFooter.BackColor = RGB(225, 225, 255)
Me.Detail.BackColor = RGB(242, 242, 242)
到目前为止,我的代码看起来像这样:(它适用于我)
Public Function SetFormDefaultsIleana()
Dim i, j As Integer
Dim wrkDefault As Workspace
Dim ctrl As Control
Dim frmName As String
Set wrkDefault = DBEngine.Workspaces(0)
For i = 0 To CurrentDb.Containers.Count - 1
If CurrentDb.Containers(i).Name = "Forms" Then
For j = 0 To CurrentDb.Containers("forms").Documents.Count - 1
frmName = CurrentDb.Containers("forms").Documents(j).Name
DoCmd.OpenForm frmName, acDesign
For Each ctrl In Forms(frmName)
If ctrl.ControlType = acLabel Then
DoCmd.SetWarnings False
ctrl.ForeColor = RGB(0, 0, 0)
'..
Next
DoCmd.Save acForm, frmName
DoCmd.Close acForm, frmName
Next j
End If
Next i
End Function