Referencing a Report's Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to make a Label Control Visible based on the value of a Textbox
in my Report's Open Procedure:

If txtSubTotals.Text = "No Data" Then
lblMessage.Visible = True
Else
lblMessage.Visisble = False
End if

The problem is I am receiving this error message:

"2185" You can't reference a property or method
for a control unless the control has focus.

I am a little confused because I am using a Label Control on my Report.
Could you please provide with the proper code to accomplish this task. I
tried looking for this error in the Knowledgebase (No Luck).
 
Tru said:
I am trying to make a Label Control Visible based on the value of a Textbox
in my Report's Open Procedure:

If txtSubTotals.Text = "No Data" Then
lblMessage.Visible = True
Else
lblMessage.Visisble = False
End if

The problem is I am receiving this error message:

"2185" You can't reference a property or method
for a control unless the control has focus.

I am a little confused because I am using a Label Control on my Report.
Could you please provide with the proper code to accomplish this task. I
tried looking for this error in the Knowledgebase (No Luck).


Your use of the Text property is causing the error. You
should use the Value property instead.

However, since you said you were doing this in the report's
Open event, that shouldn't work either, The Open event is
too early for the Value property of controls to be
available,

Perhaps I could make an alternative suggestion if you
explained what you're trying to accomplish in the report.
 
Back
Top