Changing a textBox value

D

dshemesh

Hello,
I have a report which I want to be able to change its title dynamically
(using VB) when the report is opened.
I tried to write on the report_open event:

If ....
Me.title = "a"
Else
Me.title = "b"
End If

But I get a mssage that I'm not allowed to assign a value to this object
(runtime error 80020009).
Is there any way doing this?
thank you
 
S

Steve Schapel

dshemesh,

I think you need the report's Caption property, not Title.
Me.Caption = "a"
 
D

dshemesh

No, I'm talking about a textBox I added to the report. the textBox's name is
"title". I want to change the content of this textBox everytime I open the
report.

10x
 
S

SusanV

Search the newsgroups or help for OpenArgs - you can set the title
dynamically using that.
 
D

Duane Hookom

Try place the code in the On Format event of the section containing the text
box. The text box must not have any control source.
 
S

Steve Schapel

Sorry, Dshemesh, I misunderstood your original question.

In addition to Duane's suggestion, another option might be to just set
the Control Source of the textbox using an IIf() function or a Switch()
function, depending on the condition you are trying to apply in
determining the value of the textbox.
 
Top