Can someone give me the VBA code to globally change the back style for all my
controls on reports to be transparent?
Thanks
Tony
The following should change all label and text box controls backstyle
to transparent. If you are using any other type of controls that have
a BackStyle, add that type to the If TypeOf ctl Is line of code using
an Or as operator.
Public Sub ChangeControlProperty()
On Error GoTo Err_Handler
Dim db As DAO.Database
Dim doc As Document
Set db = CurrentDb
Dim ctl As Control
For Each doc In db.Containers("Reports").Documents
DoCmd.OpenReport doc.Name, acViewDesign, , , , acHidden
For Each ctl In Reports(doc.Name)
If TypeOf ctl Is TextBox Or TypeOf ctl Is Label Then
ctl.BackStyle = 0
End If
Next
DoCmd.Close acReport, doc.Name, acSaveYes
Next
Exit_Sub:
Exit Sub
Err_Handler:
MsgBox "Error " & Err.Number & " " & Err.Description
Resume Next
End Sub