Globally chaning typefaces in Access 2002 forms.

  • Thread starter Thread starter Frank
  • Start date Start date
F

Frank

A have a database in 2002 that has about 50 forms. The forms have different
typefaces in them. I want to globally change all typefaces in all form to
Times New York.

Is there a way to do it without having to go to each form and change them
that way?

Any assistance is greatly appreciated.
 
These 2 routines will set the font for all controls on a given form(s) to
the name you specify. To do all 50 of your forms, call
ChangeAllFormsCtrlsFont from the immediate window with the font you want as
the argument. ChangeFormCtrlsFont allows you to do an individual form.



Sub ChangeFormCtrlsFont(FormName As String, FontName As String)

Dim frm As Form
Dim varCtrl As Control

On Error Resume Next

DoCmd.OpenForm FormName, acDesign

For Each frm In Forms
If frm.Name = FormName Then
For Each varCtrl In frm.Controls
varCtrl.FontName = FontName
Next
End If
Next

End Sub

Sub ChangeAllFormsCtrlsFont(FontName As String)

Dim db As Database
Dim doc As Document
Dim cnt As Container
Dim frm As Form

On Error Resume Next

Set db = CurrentDb()
Set cnt = db.Containers("Forms")
For Each doc In cnt.Documents
DoCmd.OpenForm doc.Name, acDesign
For Each frm In Forms
If frm.Name = doc.Name Then
ChangeFormCtrlsFont frm.Name, FontName
End If
Next
DoCmd.Close acForm, doc.Name
Next

End Sub
 
Back
Top