Hope you had a great vacation.
According to your information below, you recommended that I put :
Me.Title = Me.OpenArgs
in the report text box section;s FORMAT event
(Title is the name of the textbox)
When I did that, it changed it to something like:
"[Me]."&"[Title]"="[Me]."&"[OpenArgs]"
If I put "=Me.OpenArgs" in the ControlName field of the text box, when the
report runs, it asks for the value of Me.
An example of the OpenArgs string would be: "# 521" when ran from one form
and "07-2007 information" when ran from the other form.
Marshall Barton said:
I just got back from vacation and hope you didn't think your
question was abandoned.
Me is only valid in VBA class modules, it has no meaning in
queries, control expressions, or propertiy settings. In
control expression and some property settings you can use
Report for the same effect.
I don't understand what you are trying to describe when you
say "It adds quotes around some of the letters...". Could
provide an example of the combo box's value and the string
that you are seeing in OpenArgs?
--
Marsh
MVP [MS Access]
RW wrote:
OK, this is what I did in the VB behind the form button:
DoCmd.OpenReport "reportname",, acViewPreview, OpenArgs:= Me.CboNumber
When I add the following to the
report text box section;s FORMAT event (as you indicated):
Me.Title = Me.OpenArgs
It adds quotes around some of the letters and thus doesn't work. I've also
tried adding = Me.OpenArgs to the Control Source of the Text Box and I get a
prompt asking for the value of Me
What am I missing?
:
RW wrote:
The report has a text control that has an IIF statement that looks at a
particular field on Form 1 and populates itself based on what is on that
form.
Now I need this same report to run from another form and populate the same
text control with data from a control on Form 2.
Only 1 form is open at any given time. With the report control set to Form
1, it displays #Name? when it is run from Form 2. Is there a way to check for
#Name? and use the control in Form 2 if it occurs?
What are you doing with the form reference? If it's just to
display a value, then remove the reference from the report
text box and pass the value to the report. The form button
to open the report would do:
DoCmd.OpenReport "reportname", acViewPreview, _
OpenArgs:= Me.theformtextbox
and the code in the report text box section;s Format event:
Me.the reporttextbox = Me.OpenArgs