Using Inputbox to assign value to text box

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

Guest

Hello,

Please help! I am trying to do something that I thought was very simple but
quickly found out that it is not so simple.

My report's RecordSource is based on a table but there are many textboxes on
the report that are Unbound. On the OnOpen procedure, I want the user to
input data using inputboxes and then assign the value of the inputbox to a
text box. I get an error message that says "You can't assign a value to this
object."

I have tried putting the "Dim MyValue as String" in the General Declarations
but I still get the same error message. Here is my code.

Option Compare Database
Dim MyValue As String

Private Sub Report_Open(Cancel As Integer)

MyValue = InputBox("Enter Date Initiated (DD/MMM/YYYY)", "Date
Initiated", , 1100, 1100)
Me.txt_Date_Initiated = MyValue

End Sub
 
You've described "how" you are trying to do something (use InputBox to get
values to put into a report).

If you describe a bit more "what" you are trying to do (e.g., ?produce a
report with values the user has selected/indicated?), the newsgroup readers
may be able to offer more specific suggestions.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Never mind. I figured it out myself. All you have to do is set the
ControlSource for each text box to [Text] to make the report prompt the user
when the report is run. For example, on text box "Date_Initiated", the
ControlSource should be set to =[Enter Date Initiated].

Thanks anyway.
 
Your description still uses an InputBox ... that's only one way to get data
from a user.

(Glad you figured out a solution...)

Regards

Jeff Boyce
Microsoft Office/Access MVP
 

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

Back
Top