Referring to values on Forms and Reports

  • Thread starter Thread starter Chuck Moore
  • Start date Start date
C

Chuck Moore

I am having no succes in using the expressions that appear
in the training manual and in the help documentation. i
want to include the total field in one Report in another
report. For example one report lists all of the types of
issues and counts them. Another report list the
particulars of one type of issue and totals this
particular type. I want to include another control that
lists the total number of issues from the first report.

I keep getting a #name error. The documentation refers to
an "open form" or an "open report". What is the
significance of the word "open" and is this my problem?
 
Chuck Moore said:
I am having no succes in using the expressions that appear
in the training manual and in the help documentation. i
want to include the total field in one Report in another
report. For example one report lists all of the types of
issues and counts them. Another report list the
particulars of one type of issue and totals this
particular type. I want to include another control that
lists the total number of issues from the first report.

I keep getting a #name error. The documentation refers to
an "open form" or an "open report". What is the
significance of the word "open" and is this my problem?

Open means it is currently visible on your screen (unless hidden). You have
to realize that the Forms and Reports that you see in the dbWindow are only
objects that store the design construct of the form and reports. They do not
contain data or any values until they are "executed" and loaded with data from
your tables or other means. Beyond that is that the samples you are looking at
are likely using the Forms and Reports collections.

Forms!SomeFormName!SomeFieldName
or
Reports!SomeReportName!SomeFieldName

These two collections only include the forms and reports respectively that are
currently open. They do not include all of the non-open forms and reports that
you can see in the dbWindow so even if those closed objects did have some values
these collections would not provide a mechanism to get at them.
 
You cannot read the total from one report into another. The calcuation only
exists for the fleeting instant that Access is preparing the section of the
report where that number will be printed.

It's probably easiest to use a DSum() expression on your other report to
calcuate the total.

Alternatively, you could delcare a public variable to hold the value, write
to the variable when the report section prints, and read the value in the
Format event of your other report.

The issue does not arise for forms. Since the calculated total in the Form
Footer section is always present and updatable, you can read it at any time.
 
Thanks for the help. It must be obvious that I am a real
novice. Is there another way around this within my query.

The other possibility would seem to modify my query but I
can't seem to do it. For example, my query selects only
certain records based on a criteria and it works fine and
I can create a "count" of the records selected. For
example, my query selects 20 records. Is there any way in
the query to count all of the records in the table, both
the ones that match the criteria plus the ones that do
not. I want to be able to show on the report that only 20
out of 100 records fall into a certain category.

Thanks.
 
Back
Top