Referencing a Report's Control

T

Tru

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).
 
M

Marshall Barton

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.
 

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