Change Properties on RunTime

  • Thread starter janiotjoeawie via AccessMonster.com
  • Start date
J

janiotjoeawie via AccessMonster.com

Hi all,

In order to give the users the option to change some properties of the report
on runtime (like the fontweigth and size). If created a table with all the
needed values loaded.
My problem is I can't figure out how to load these properties at runtime.
I've tried it on open, activate and on page but so far no luck.
The farest have been : me.NaamBadge.Properties.Item(29)
(naamBadge is the name of the control) this gives me that my font name is
'news gothic'
How do I now that this is the font name, not by just guessing the number?

Jânio
 
S

SteveM

Try the OnPrint event of each section you want to modify.
In the event procedure, you will have to set the properties for each field
you want to change.

Steve
 
M

Marshall Barton

janiotjoeawie said:
In order to give the users the option to change some properties of the report
on runtime (like the fontweigth and size). If created a table with all the
needed values loaded.
My problem is I can't figure out how to load these properties at runtime.
I've tried it on open, activate and on page but so far no luck.
The farest have been : me.NaamBadge.Properties.Item(29)
(naamBadge is the name of the control) this gives me that my font name is
'news gothic'
How do I now that this is the font name, not by just guessing the number?


The Open event is a good place to set these types of
properties, but only if you want to change it for the entire
report. If you want different records to use a differernt
set of property values, then use the Format event.

If you look at the property sheet for any text box control
in the report, you will see the property names (many with
extra speces). Another way is to use Intellisense that is
made available automatically in VBA code when you type the
name of the control followed by the dot. Then, just select
the desired property.

Your example would simply be:

With Me.NaamBadge
.FontName = "news gothic"
.FontWeight = 700 'Bold '400 for normal
.FontSize = 12
End With
 
K

krissco

The farest have been : me.NaamBadge.Properties.Item(29)
How do I now that this is the font name, not by just guessing the number?

Forget about the number. To get a list of properties available for a
control, use the following code in the report module (place in
OnFormat or somewhere . . .)

on error resume next 'this is necessary as not all properties are
available at all times for a control.
dim prp as property
for each prp in me.NaamBadge.Properties
debug.print prp.name & " " & prp.value
next prp

This will give you a list of properties and their current values.
Don't worry about the property not showing up in intellisense - go
ahead and type it. Such as - me.NaamBadge.FontSize = 45

-Kris
 
J

janiotjoeawie via AccessMonster.com

Thankx guys,

I think (know pretty sure) that these answers will solve my problem
 

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