I trying to change all the forms header, footer, and detail background color in my access database with VBA code. Any idea would be helpful.
I m able to change the labels forecolor and backcolor with below code but no luck for header, detail and footer back color.
Dim frmObj As Access.Form
Dim frm As Object
Dim ctl As Control
For Each frm In CurrentProject.AllForms
If InStr(frm.name, "frm") And Not InStr(frm.name, "switchboard") Then
DoCmd.OpenForm frm.name, acDesign
Set frmObj = Forms(frm.name)
For Each ctl In frmObj.Controls
Select Case ctl.ControlType
Case acBoundObjectFrame
Case acCheckBox
Case acComboBox
Case acCommandButton
Case acImage
Case acLabel
ctl.ForeColor = 16777215
ctl.BackColor = 4145843
Case acLine
Case acListBox, acComboBox
Case acObjectFrame
Case acOptionButton
Case acOptionGroup
Case acPage
Case acPageBreak
Case acRectangle
Case acSubform
Case acDetail
ctl.BackColor = 14211288
Case acTabCtl
Case acToggleButton
End Select
Next
DoCmd.Close acForm, frm.name, acSaveYes
DoEvents
End If
Next
I m able to change the labels forecolor and backcolor with below code but no luck for header, detail and footer back color.
Dim frmObj As Access.Form
Dim frm As Object
Dim ctl As Control
For Each frm In CurrentProject.AllForms
If InStr(frm.name, "frm") And Not InStr(frm.name, "switchboard") Then
DoCmd.OpenForm frm.name, acDesign
Set frmObj = Forms(frm.name)
For Each ctl In frmObj.Controls
Select Case ctl.ControlType
Case acBoundObjectFrame
Case acCheckBox
Case acComboBox
Case acCommandButton
Case acImage
Case acLabel
ctl.ForeColor = 16777215
ctl.BackColor = 4145843
Case acLine
Case acListBox, acComboBox
Case acObjectFrame
Case acOptionButton
Case acOptionGroup
Case acPage
Case acPageBreak
Case acRectangle
Case acSubform
Case acDetail
ctl.BackColor = 14211288
Case acTabCtl
Case acToggleButton
End Select
Next
DoCmd.Close acForm, frm.name, acSaveYes
DoEvents
End If
Next