Change the default font used on form and report

S

Smiley

Hi,

Would anyone give me some guide line how to change the default font used in
Form and Report in MSAccess 2003. I went thought the tabs in Tools -->
Options but none seem to work.

I don't like the default font used at present which is MS Sans Serif size 8.
I would like to use another font which is bolder and larger sizes. I don't
want to change the size and font from the property for every form and
report. Is there a way to do it before I create the form and report so that
I would save a bit of work ?

Thank for your help in advance.
 
D

Douglas J. Steele

Select the text box from the tool bar, but don't copy it anywhere. Go to the
Properties window: it should say "Default Text Box". Set the properties for
what you want as the defaults. All future use of the text box control will
now have the properties you defined. Do the same for any other controls you
want.
 
M

Marshall Barton

Smiley said:
Would anyone give me some guide line how to change the default font used in
Form and Report in MSAccess 2003. I went thought the tabs in Tools -->
Options but none seem to work.

I don't like the default font used at present which is MS Sans Serif size 8.
I would like to use another font which is bolder and larger sizes. I don't
want to change the size and font from the property for every form and
report. Is there a way to do it before I create the form and report so that
I would save a bit of work ?


For existing text boxes, you can write a little code to loop
through the Form/Report documents and their controls
collection to set the properties. If you do this, be aware
that when you use a larger font, you may need larger text
boxes to display the values.
 
S

Smiley

Hi Douglas,

Thank you for the info.

But this only work on a form. I.e. I start a new form or modify an existing
form in Design view. After I done the amendment, there after Whatever fields
I create will be on the amended font and size. But when I start a new form
either in design mode or using the Wizard, the default font and size are
back to MS Sans Serif size 8 again. What I have not done right to get this
result. What I really want is basically change the basic default to other
font and sizes so that whether I am using design view or form wizard, I will
get the newly amended font and size. Is this achievable ?

Regards,

Smiley
 
S

Smiley

Hi Marsh,

Do you have an example to start me off. I am not too familiar with coding

Many thanks in advance,
 
M

Marshall Barton

Smiley said:
Do you have an example to start me off. I am not too familiar with coding


Here's some code that I tweek to make global changes like
you want:

Dim dbCur As Database
Dim doc As Document
Dim ctl 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 = 10
Next ctl
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 = 10
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
 
S

Smiley

Hi Marshall,

Thank you for the code. Shall try it out but it may be some days before I
can give you an update.

Have a good day,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top