changing font globable

  • Thread starter Thread starter Gonzosez
  • Start date Start date
G

Gonzosez

How can I change the font on all my forms programicly
I want my customer to be able to pick font as part of set up.
I have the set up part done now how do I get it to work
Thanks
 
I am quite new to this but I thought I would have a go at helping, any
criticism will be happily taken on.


Are you storing the font name in a table? If so you could have an event
on the 'on open'

for example to hard code the font name would be

Me.Label1.FontName = "Terminal"

then you need to access your font from the table

dim db as database
dim rs as recordset

set db = currentdb()
set rs = dbs.OpenRecordset("settings", dbOpenTable)

with rs (This assumes that you only have one
record in your database and does no error checking)
.movefirst
newfont = !fontdesc ( newfont is the veriable to store the
fontname)
end with (fontdesc is the fieldname in your
table)


Then your on open event would be

Me.Label1.FontName = newfont
 
Basically there are two ways to go.

1) Write code that opens every form and subform, one at a time, in
design view, and then iterates through the form's Controls collection,
setting the font-related properties of each (if it has any).

2) In the Open event of every form or subform, call code that gets the
user's font settings from the table where you stored them, then iterates
through the form's Control's collection as above.

For either, you could use something like this snippet of *air code*


Dim C as Control

On Error Resume Next
For Each C in Me.Controls
C.FontName = FontName
C.FontSize = FontSize
Next
On Error GoTo 0

But how are you going to adjust the sizes of your forms and controls to
suit the font the user selects?
 
Back
Top