Reference a Class Property in a text box control

D

Darrell

I would like to be able to reference a property of a class in the control
source of a text box on a report. Is there any way to do this? (I get #Name?
when I put "=[classname.propertyname]" in the control source for the text box.

Thanks in advance for all help.
 
O

Ofer Cohen

Use the OnPrint section event where the text box located in to assign the
value to the text box

me.textBox = classname.propertyname
 
D

Darrell

Thank you very much! This could prove to be very helpful. I still have some
fancier syntax to put in the control, but the basic principle should clear
the way for utilizing the property however I need to.

Thank you again.
--
Darrell


Ofer Cohen said:
Use the OnPrint section event where the text box located in to assign the
value to the text box

me.textBox = classname.propertyname

--
Good Luck
BS"D


Darrell said:
I would like to be able to reference a property of a class in the control
source of a text box on a report. Is there any way to do this? (I get #Name?
when I put "=[classname.propertyname]" in the control source for the text box.

Thanks in advance for all help.
 
M

Marshall Barton

Darrell said:
I would like to be able to reference a property of a class in the control
source of a text box on a report. Is there any way to do this? (I get #Name?
when I put "=[classname.propertyname]" in the control source for the text box.


Ofer provided a way that works in reports, but there are
situations where you do not have a Format/Print event to
use. In these other cases, create a public function in a
standard module that returns the property's value:

Public Getpropertyname()
Getpropertyname = classname.propertyname
End Function

Kind of defeats the purpose of the class' properties, but I
don't think classes were intended to be available outside
the VBA namespace/environment
 
Top