Global change for forms

  • Thread starter Thread starter Tony Williams
  • Start date Start date
T

Tony Williams

Marshall Burton and Douglas Steele gave me some great code for global
changing the fonts on all my forms and reports. I now want to globally
change the backcolour of the forms and subforms. can anyone help me with the
code. Please note I'm not a VBA expert but learning slowly!
Thanks
Tony
 
Marshall Burton and Douglas Steele gave me some great code for global
changing the fonts on all my forms and reports. I now want to globally
change the backcolour of the forms and subforms. can anyone help me with the
code. Please note I'm not a VBA expert but learning slowly!
Thanks

can you post the VBA you're current using to change the Fonts?


Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
I'm using this and comment out the controls I don't want changing when I run
it
Cheers
Tony
Public Sub ChangeAllControlProps()
Dim dbCur As Database
Dim doc As Document
Dim ctl As Control
Dim lbl As Control
On Error GoTo ErrHandler

Set dbCur = CurrentDb

For Each doc In dbCur.Containers("Forms").Documents
DoCmd.OpenForm doc.Name, acDesign
For Each ctl In Forms(doc.Name)
ctl.FontName = "Arial"
'ctl.FontSize = 8
ctl.ForeColor = 0
ctl.BackColor = RGB(255, 255, 255)
'ctl.FontWeight = "Normal"

Next ctl
For Each lbl In Forms(doc.Name)
If TypeOf lbl Is Label Then
lbl.ForeColor = 8388672
End If

Next lbl


DoCmd.Close acForm, doc.Name, acSaveYes
Next doc

For Each doc In dbCur.Containers("Reports").Documents
DoCmd.OpenReport doc.Name, acDesign
For Each ctl In Reports(doc.Name)
ctl.FontName = "Arial"
ctl.FontSize = 8
ctl.ForeColor = 0
Next ctl
DoCmd.Close acReport, doc.Name, acSaveYes
Next doc

ExitHere:
Set dbCur = Nothing
Exit Sub

ErrHandler:
Select Case Err.Number
Case 438 'Property does not exist
Resume Next
Case Else
MsgBox Err.Number & " - " & Err.Description
Resume ExitHere
End Select
End Sub
 
Back
Top