Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ObjectVariable property

Status
Not open for further replies.

ddiamond

Programmer
Apr 22, 2005
918
US
According to the help, by setting a controls ObjectVariable property, you can then reference that control elsewhere in your code. I've tried but cannot seem to get this to work. Can someone give me an example of this?
 
Hi,
U can access any control anywhere in the report but u need to use proper qualifiers.

E.g. u have a label on a frame.
Frame Object Variable = obj_frm_parent
Label Object Variable = obj_lbl_kid

On any of the FRAMES method (like onRow, Finish) u can access labels property by following way:
obj_lbl_kid.value = "something"

Now, u wish to access this label from another frame.
Then u might need to write code like this:
obj_frm_parent.obj_lbl_kid.value = "Another Thing"
(check the "." again. U might need to use ::)

Hope this helps!
Thanks!
 
To write the conditional code, override a method in the frame that contains both controls. Choose a method that the Factory calls any time after the data values are available, such as the frame's OnRow( ) method or, for accessing an aggregate control, the frame's Finish( ) method.
"How To"
1. Assign a value to the ObjectVariable property of the control. i.e. assign SalesPrice to PriceCurrencyControl.
Do not use the name of a existing method or control when you assign a value to ObjectVariable. If done an error occurs when report compiles.

2. Assign a value to the ObjectVariable property of the second control. i.e. assign LuxuryFlag to CodeLabel Control.

3. Override the OnRow() method of the containing frame to write the Conditional code:
Sub OnRow(row As AcDataRow)
Super::OnRow(row)

If SalesPrice.DataValue > 35000 Then
LuxuryFlag.Text = "Luxury"
LuxuryFlag.Font.Color=Red
End If
End Sub

Using ObjectVariable, you can access a control only from its cotaining frame, not from another control.
Hope this helps,
AbbyNL
 
abhijitkolhatkar,

I have a browser scripting control and a pagenumber control sitting on the same page. I want to access the pagenumber control from within the BrowserCode() method. In this case, would I need to reference to parent object?

AbbyNL,

Thanks for your example. My code looks similar to yours, but I am getting a compile error. I'll see if I can figure out how your example differs from mine.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top