Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change form style for complete database

Status
Not open for further replies.

ali32j

Technical User
Apr 23, 2007
97
GB
Hi All

I am using Access 2007, i wondered if there was a fast way to apply a form style to the complete database in one hit rather than going through each form and changing manually. i.e set form colours, title, fonts etc to the same

Appreciate your help

Ali
 
I use this code in the on open event of all forms to give a standard look in all my forms

Hope this helps Jimmy


Dim CTL As Control

Me.Detail.BackColor = 13882281
Me.FormFooter.BackColor = 13882281
Me.FormHeader.BackColor = 13882281
For Each CTL In Me.Controls
If CTL.ControlType = acTextBox Or CTL.ControlType = acComboBox Or CTL.ControlType = acListBox Then
CTL.BackColor = 15592924
CTL.BorderColor = 8421504
CTL.FontName = "Tahoma"
CTL.FontSize = 8
End If
Next CTL




 
How are ya ali32j . . .

Be aware, permament style changes have to be made and saved in form design view! Taking this into account and inserting [blue]ClydeData's[/blue] code into a [blue]One Shot Deal[/blue], we have:
Code:
[blue]Public Sub ChangeFormStyles()
   Dim obj As AccessObject, frm As Form, Ctl As Control
   
   For Each obj In CurrentProject.AllForms
      DoCmd.OpenForm obj.Name, acDesign, , , , acHidden
      DoEvents
      Set frm = Forms(obj.Name)
      
      frm.Detail.BackColor = 13882281
      frm.FormFooter.BackColor = 13882281
      frm.FormHeader.BackColor = 13882281
      
      For Each Ctl In frm.Controls
         If Ctl.ControlType = acTextBox Or _
            Ctl.ControlType = acComboBox Or Ctl.ControlType = acListBox Then
            Ctl.BackColor = 15592924
            Ctl.BorderColor = 8421504
            Ctl.FontName = "Tahoma"
            Ctl.FontSize = 8
         End If
      Next
      
      DoCmd.Close acForm, obj.Name, acSaveYes
      DoEvents
      Set frm = Nothing
   Next

End Sub[/blue]

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top