Runtime Error '2448' Can't assign Value

J

JJ

When a report opens, I have a input box that captures a name. I would like
that name to be populated in an unbound text box (TextName) on a form.
However, I keep getting the erro message '2448' that I can't assign a value
to the text box....please help...

Private Sub Report_Open(Cancel As Integer)

Dim Message, Title, Default, MyValue As String
Message = "Enter the Name."
Title = "Name"
Default = "JJ"
MyValue = InputBox(Message, Title, Default)

Me.TextName = MyValue

End Sub
 
D

Duane Hookom

Does your text box have a control source value?
Consider storing MyValue in a variable in the report and then assign the
value in the On Format event of the section containing Me.TextName.
 
K

Ken Snell [MVP]

Your code is trying to write a value into a control named TextName on the
report, not on a form. To write it to a form's control:

Forms!NameOfTheForm!TextName = MyValue
 
J

JJ

The text box does not have a control source value. How do you store MyValue
as a variable? also I do not see the On Format event in the events of teh
text box?
 
O

Ofer

The on format is on the detail section where the text box is in, and not in
the field properties
 
D

Duane Hookom

Move this to the General ... Declarations section of the module window
Dim MyValue As String
 
Top