×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

ObjectVariable property

ObjectVariable property

ObjectVariable property

(OP)
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?

RE: ObjectVariable property

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!

RE: ObjectVariable property

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

RE: ObjectVariable property

(OP)
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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close