Read from a report or form

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

Guest

I was wondering if it is possible to read from a report or form to get
information used on a report. If you go into the expression builder, it would
appear that this supposedly can be done. Both reports and forms are listed as
folders, and you can use fields from your forms or reports.

One example would be using a number calculated in one report (therefore, not
existing in any query or table) for calculations in another report.

Another example would be one report my company is trying to do. The report
is somewhat automatic. When you go to run the report, it asks you to enter a
beginning date and an end date, then runs the report. That works fine, but we
are trying to get the report to then write the date range you entered in its
own header. All we get is the #Name? error. That usually comes when something
isn't in your record source, but you can't add a report or form to the record
source. Any ideas, anybody?

--
Have a nice day!

~Paul
Express Scripts,
Charting the future of pharmacy
 
Paul said:
I was wondering if it is possible to read from a report or form to get
information used on a report. If you go into the expression builder, it would
appear that this supposedly can be done. Both reports and forms are listed as
folders, and you can use fields from your forms or reports.

One example would be using a number calculated in one report (therefore, not
existing in any query or table) for calculations in another report.

Another example would be one report my company is trying to do. The report
is somewhat automatic. When you go to run the report, it asks you to enter a
beginning date and an end date, then runs the report. That works fine, but we
are trying to get the report to then write the date range you entered in its
own header. All we get is the #Name? error. That usually comes when something
isn't in your record source, but you can't add a report or form to the record
source. Any ideas, anybody?


Generally, you can not retrive a value from one report to
use in another. If you need to perform the same calulation
in two or more reports, you should just duplicate the
calculation in all the places it's needed or, if its even a
little complicated, create a user defined function in a
standard module and call the function as needed.

As for using the report's record source query's parameters
in a report text box, you can refer to the parameter as if
it were any other field in the query's field list.
 
I kinda thought that was what we were doing, but it isn't working. When you
open the report, a popup window asks for a beginning date. You put that in,
press enter (or okay, or whatever it says) and another popup asks for the end
date. So, say for example the popups say:

RangeBeginDate =

and

RangeEndDate =

What would I type in the header in order to get it to show in the following
format:

6/4/05 - 2/23/06

Any continued help is greatly appreciated. I've got myself in a dilly of a
pickle. Also, out of curiosity, why does the code builder let you select
fields from a report or form if you cannot actually use them for a report?

--
Have a nice day!

~Paul
Express Scripts,
Charting the future of pharmacy
 
Paul said:
I kinda thought that was what we were doing, but it isn't working. When you
open the report, a popup window asks for a beginning date. You put that in,
press enter (or okay, or whatever it says) and another popup asks for the end
date. So, say for example the popups say:

RangeBeginDate =

and

RangeEndDate =

What would I type in the header in order to get it to show in the following
format:

6/4/05 - 2/23/06

Any continued help is greatly appreciated. I've got myself in a dilly of a
pickle. Also, out of curiosity, why does the code builder let you select
fields from a report or form if you cannot actually use them for a report?


The report text box to displau the date range would use an
expression like:

=[RangeBeginDate =] & " - " & [RangeEndDate =]

The exact string inside the [ ] must be **exactly** the same
as you used in the query.

The code builder is just a convenience for beginners, and it
is not sophisticated enough to figure out where a reference
makes sense or not. A reference to a report control is very
common within the same report. It is legal to do that from
another report, but, in practical situations, it is a
difficult scenario to arrange properly.
 
Back
Top