Change font by user before printing labels

R

Richard S.

I would like to display the FontSize and FontName for a labels report prior
to opening (previewing/printing) the report to enable the user to select from
alternative choices in combo boxes. How do I access the current property
values before previewing/printing the report to display the current values in
a form for the user, and then modify the report properties to match the
user's selections?

The report would be selected from a combo box listing of available reports.
The intent is that after the user has selected a report and is satisfied
with the selection of font (and other unrelated options), he would click a
command button to preview/print the report.

I will appreciate any assistance.
 
K

Kari

Richard,

I'm no expert, but since no one else has jumped in here, I have an idea that
may help you get started.

If you put an unbound textbox on your form you can set the Control Source to =
=[Reports]![YourReportName]![YourControlName].[FontName]. This will show
the current font for that control. The report probably has to be open for it
to work, but you could open the report minimized or set [Visible] to "No"
until your "Print Report" button was clicked. I wonder if you could use this
for the default value of a combo box that listed the available fonts?
(please note that I'm thinking out loud here and I haven't actually tried it.)

BTW I figured out the syntax for the Control Source by clicking on the build
button (has 3 periods on it, ...) in Control Source (in the Properties
window), clicking my report in the left column, the control name in the
center column, and the property I wanted to know in the right column, then
clicking "Paste".

I have no idea how you would go about pulling a list of available fonts from
Access. Maybe you could manually make a list of a few common fonts. Just
make sure that all the fonts you list are available on all the machines that
this db will be deployed on, or have a way to trap that error.

Font size should be even easier because you can list a few possible sizes
and be done with it.

On your "Print Report" button you should be able to do something like
[Reports]![YourReportName]![YourControlName].[FontName] = "Arial" (in VB, not
in a macro). I'm not sure what the correct syntax would be; you'll have to
play with it to get it just right.

I hope that helps you get started and doesn't make you more confused. :)

Good luck!

Kari
 
R

Richard S.

Kari,

Thank you for your response.

The format is correct; however, if placed in the VBA code prior to opening
the label-printing report, it results in an error because the report is not
open; if it follows the report being opened, it has no effect.

My solution was to define public variables for fontsize, fontname, fontbold,
fontitalic, and fontcolor; then to update any of the variables upon
user-action; then finally to incorporate the assignment of the values to each
of the 5 text boxes in the report in a public procedure, which is invoked in
the open event of the report - which alters the font correctly.

Access documentation states that such changes can only be accomplished
during a report event.

Kari, thanks again for your information; it was helpful.

Kari said:
Richard,

I'm no expert, but since no one else has jumped in here, I have an idea that
may help you get started.

If you put an unbound textbox on your form you can set the Control Source to =
=[Reports]![YourReportName]![YourControlName].[FontName]. This will show
the current font for that control. The report probably has to be open for it
to work, but you could open the report minimized or set [Visible] to "No"
until your "Print Report" button was clicked. I wonder if you could use this
for the default value of a combo box that listed the available fonts?
(please note that I'm thinking out loud here and I haven't actually tried it.)

BTW I figured out the syntax for the Control Source by clicking on the build
button (has 3 periods on it, ...) in Control Source (in the Properties
window), clicking my report in the left column, the control name in the
center column, and the property I wanted to know in the right column, then
clicking "Paste".

I have no idea how you would go about pulling a list of available fonts from
Access. Maybe you could manually make a list of a few common fonts. Just
make sure that all the fonts you list are available on all the machines that
this db will be deployed on, or have a way to trap that error.

Font size should be even easier because you can list a few possible sizes
and be done with it.

On your "Print Report" button you should be able to do something like
[Reports]![YourReportName]![YourControlName].[FontName] = "Arial" (in VB, not
in a macro). I'm not sure what the correct syntax would be; you'll have to
play with it to get it just right.

I hope that helps you get started and doesn't make you more confused. :)

Good luck!

Kari



Richard S. said:
I would like to display the FontSize and FontName for a labels report prior
to opening (previewing/printing) the report to enable the user to select from
alternative choices in combo boxes. How do I access the current property
values before previewing/printing the report to display the current values in
a form for the user, and then modify the report properties to match the
user's selections?

The report would be selected from a combo box listing of available reports.
The intent is that after the user has selected a report and is satisfied
with the selection of font (and other unrelated options), he would click a
command button to preview/print the report.

I will appreciate any assistance.
 

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