Windows font dialog-

  • Thread starter Thread starter Deb Smith
  • Start date Start date
D

Deb Smith

Is it possible to have an end-user select/change the font style, font size
etc. used in a report when the end-user can only preview or print selected
reports?

I have a series of predefined and formatted reports. The end-user chooses
the report they desire from a form along with other parameters for the
report, they then click on a command button to either preview or print the
report.(Very standard stuff) I would like to have the user be able to select
font style, bold, italics, etc once they have previewed the
report.Preferably this would be from another command button on the criteria
selection form. Is this possible?

Using a Windows API and following detailed instruction of others, I have
been able to call up the windows font dialog box from a command button on a
form. I can get the font dialog to apply to fields on the current form. I
cannot however, get the selection from the font dialog to apply to a
pre-determined report.

If it is possible to do this, can someone point me in an appropriate
direction to resolve this dilemma.

Thanks. Its greatly appreciated
 
1. you might put the code that opens the font dialog in
with the code that opens the report.
2.you might build a custem menu and assign a macro to an
icon that runs the code to open the fond dialog box.
 
Private Sub Report_Open(Cancel As Integer)

Me!Text0.FontSize = Forms!Form4!Text0.Value

End Sub

Where the first "Text0" is the name of the control on the report you want to
apply the setting to, "Form4" is the name of the form used by the user to
select the setting, and the second "Text0" is a control on the form where
that setting has been stored. This assumes that the form is open when the
report is opened. Otherwise, you'd need to store the values somewhere before
closing the form, for example in a table, and look them up there when
opening the report.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox "SelectedEvents". I have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed. I just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this problem. I
am going crazy.

Thanks again for the help.
 
You've shown us the code from the form, Deb, but have you added code to the
Open event of the report, as I suggested?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox "SelectedEvents". I have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed. I just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this problem. I
am going crazy.

Thanks again for the help.
Brendan Reynolds said:
Private Sub Report_Open(Cancel As Integer)

Me!Text0.FontSize = Forms!Form4!Text0.Value

End Sub

Where the first "Text0" is the name of the control on the report you
want
to
apply the setting to, "Form4" is the name of the form used by the user to
select the setting, and the second "Text0" is a control on the form where
that setting has been stored. This assumes that the form is open when the
report is opened. Otherwise, you'd need to store the values somewhere before
closing the form, for example in a table, and look them up there when
opening the report.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


on
form.
 
Sorry;
I omitted to say I had added the following code to the open event procedure
of the report
Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.Value
I changed the With statement in Command "FontChange" to With SpecificEvent

As stated previously, the font changes in the textbox but not on the report.

Any suggestions? Thanks for the help

End Select
Next
Brendan Reynolds said:
You've shown us the code from the form, Deb, but have you added code to the
Open event of the report, as I suggested?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox "SelectedEvents". I have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed. I just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this
problem.
I
am going crazy.

Thanks again for the help.
want font
size print
the button
on form.
 
Try "Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.FontName"

Note that the change from the earlier example is .FontName instead of
..Value - I had orignally assumed that the text box on the form contained the
name of the chosen font.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Sorry;
I omitted to say I had added the following code to the open event procedure
of the report
Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.Value
I changed the With statement in Command "FontChange" to With SpecificEvent

As stated previously, the font changes in the textbox but not on the report.

Any suggestions? Thanks for the help

End Select
Next
Brendan Reynolds said:
You've shown us the code from the form, Deb, but have you added code to the
Open event of the report, as I suggested?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData
shows
the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox "SelectedEvents".
I
have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed. I just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this
problem.
I
am going crazy.

Thanks again for the help.
"Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message
Private Sub Report_Open(Cancel As Integer)

Me!Text0.FontSize = Forms!Form4!Text0.Value

End Sub

Where the first "Text0" is the name of the control on the report you want
to
apply the setting to, "Form4" is the name of the form used by the
user
to
select the setting, and the second "Text0" is a control on the form where
that setting has been stored. This assumes that the form is open
when
the
report is opened. Otherwise, you'd need to store the values somewhere
before
closing the form, for example in a table, and look them up there when
opening the report.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it
impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me
with
 
Thank you! Thank You!

It Worked!!!!!

My hours of slaving over this was quickly resolved by you and for that I am
truly greatful.

Thanks again.

Deb Smith


Brendan Reynolds said:
Try "Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.FontName"

Note that the change from the earlier example is .FontName instead of
.Value - I had orignally assumed that the text box on the form contained the
name of the chosen font.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Sorry;
I omitted to say I had added the following code to the open event procedure
of the report
Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.Value
I changed the With statement in Command "FontChange" to With SpecificEvent

As stated previously, the font changes in the textbox but not on the report.

Any suggestions? Thanks for the help

End Select
Next
Brendan Reynolds said:
You've shown us the code from the form, Deb, but have you added code
to
the
Open event of the report, as I suggested?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font
Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows
the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox
"SelectedEvents".
I replies
to to
be with for
the able
to
others,
to
 
Happy to have been able to help! :-)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Thank you! Thank You!

It Worked!!!!!

My hours of slaving over this was quickly resolved by you and for that I am
truly greatful.

Thanks again.

Deb Smith


Brendan Reynolds said:
Try "Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.FontName"

Note that the change from the earlier example is .FontName instead of
.Value - I had orignally assumed that the text box on the form contained the
name of the chosen font.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


Deb Smith said:
Sorry;
I omitted to say I had added the following code to the open event procedure
of the report
Me!Text2.FontName = Forms![LabelsDialog]!SpecificEvent.Value
I changed the With statement in Command "FontChange" to With SpecificEvent

As stated previously, the font changes in the textbox but not on the report.

Any suggestions? Thanks for the help

End Select
Next
"Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message
You've shown us the code from the form, Deb, but have you added code to
the
Open event of the report, as I suggested?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it
impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me
with
identify
a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden.
"SpecificEvent"
has as its control source the results of the selected choice from
cboEventData.
=([Forms]![LabelsDialogue]![cboEventData].[Column](4).
My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels"
Report

-a Command Button called "ChangeFont" used to open the Windows Font
Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font
using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows
the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox
"SelectedEvents".
I
have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed.
I
just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this
problem.
I
am going crazy.

Thanks again for the help.
"Brendan Reynolds" <brenreyn at indigo dot ie> wrote in message
Private Sub Report_Open(Cancel As Integer)

Me!Text0.FontSize = Forms!Form4!Text0.Value

End Sub

Where the first "Text0" is the name of the control on the report you
want
to
apply the setting to, "Form4" is the name of the form used by
the
user
to
select the setting, and the second "Text0" is a control on the form
where
that setting has been stored. This assumes that the form is open when
the
report is opened. Otherwise, you'd need to store the values somewhere
before
closing the form, for example in a table, and look them up there when
opening the report.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible
for
me to use a real e-mail address in public newsgroups. E-mail replies
to
this post will be deleted without being read. Any e-mail
claiming
to me
with others,
apply
 
Deb Smith said:
Thanks to all for the responses. Unfortunately nothing is working.

I think the problem I am having is storing the value of the selected
setting.

On my form I have the following:

- an unbound combo box called cboEventData that is used to identify a
parameter for my report.

-I have a text box "SpecificEvent" that is normallyhidden. "SpecificEvent"
has as its control source the results of the selected choice from
cboEventData. =([Forms]![LabelsDialogue]![cboEventData].[Column](4). My
report query uses 'SelectedEvent" to select the report results.

-a Command Button called "PreviewLabels" used to open the "Labels" Report

-a Command Button called "ChangeFont" used to open the Windows Font Dialog,
allow selection of the font and to set the font value etc.



The code behind my command button "ChangeFont" is as follows

Dim cdl As CommonDlg
Set cdl = New CommonDlg

cdl.hWndOwner = Me.hWnd

With cboEventData
cdl.FontName = .FontName
cdl.FontItalic = .FontItalic
cdl.FontSize = .FontSize
cdl.FontUnderline = .FontUnderline
cdl.FontWeight = .FontWeight
cdl.FontColor = .ForeColor
End With
cdl.Min = 8
cdl.Max = 24

cdl.hWndOwner = Application.hWndAccessApp
cdl.ShowFont

With cboEventData
.FontName = cdl.FontName
.FontItalic = cdl.FontItalic
.FontSize = cdl.FontSize
.FontUnderline = cdl.FontUnderline
.FontWeight = cdl.FontWeight
.ForeColor = cdl.FontColor
End With
Set cdl = Nothing

When after clicking on Command Button "ChangeFont" I change the font using
the dialog , the font is changed in cboEventData. (ie.cboEventData shows the
selection from the drop down list but now with the new font. I cannot
however get the report to reflect this change of font.

I have tried changing the With statement to textbox "SelectedEvents". I have
no further luck with this. Once again the result of the selection from
cboEventData is reflected in the textbox and the font is changed. I just
can't get the font change to reflect in my report.

Any suggestions on what I am doing wrong and how to correct this problem. I
am going crazy.

Thanks again for the help.
Brendan Reynolds said:
Private Sub Report_Open(Cancel As Integer)

Me!Text0.FontSize = Forms!Form4!Text0.Value

End Sub

Where the first "Text0" is the name of the control on the report you
want
to
apply the setting to, "Form4" is the name of the form used by the user to
select the setting, and the second "Text0" is a control on the form where
that setting has been stored. This assumes that the form is open when the
report is opened. Otherwise, you'd need to store the values somewhere before
closing the form, for example in a table, and look them up there when
opening the report.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.


on
form.
 
Back
Top