control source on a text box

  • Thread starter Thread starter jderrig
  • Start date Start date
J

jderrig

I have a report that is tied to a dialog box form that is
run by a macro. My dialog box form allows me to select an
option box and then select an area from a combo box to
filter the report (or leave combo box blank to see all
records). I would like to put a text box on the report
that is left blank if I leave the combo box on
the form blank or fills in the correct Area if I select an
area.

I currently have the report set up with a text box that is
controlled by the Area field but am not sure how to create
an expression that gives me the output that I need.
 
jderrig said:
I have a report that is tied to a dialog box form that is
run by a macro. My dialog box form allows me to select an
option box and then select an area from a combo box to
filter the report (or leave combo box blank to see all
records). I would like to put a text box on the report
that is left blank if I leave the combo box on
the form blank or fills in the correct Area if I select an
area.

I currently have the report set up with a text box that is
controlled by the Area field but am not sure how to create
an expression that gives me the output that I need.

I don't understand what you mean by "text box that is
controlled by the Area field".

A text box in a report can refer to a combo box on your form
(as long as the form is open) by just referring to it:

=Forms!theform.thecombo
 
If I select an Area from the combo box on my dialog form
(say Minnesota) and hit Print Preview, the report that
comes up has a text box that reads "Minnesota". I can do
this by setting the control property of the text box on
the report to the combo box but when I leave the combo box
blank (to return all accounts), I want the text box on the
report to remain blank.
 
Yes, but when I ran the report, it just gave me =Forms!
theform.thecombo instead of what was in the combo box.
-----Original Message-----
What I posted should do that. Did you try it?
--
Marsh
MVP [MS Access]



If I select an Area from the combo box on my dialog form
(say Minnesota) and hit Print Preview, the report that
comes up has a text box that reads "Minnesota". I can do
this by setting the control property of the text box on
the report to the combo box but when I leave the combo box
blank (to return all accounts), I want the text box on the
report to remain blank.
select
an select
an that
is

.
 
DId you put that expression in a label control's caption?
It's supposed to be in a text box's control source.

You did change the names I used to the ones you have for
your form and combo box, right?
 
Back
Top