Use one report for multiple titles

  • Thread starter Thread starter PBrown
  • Start date Start date
P

PBrown

There will be 7 and only 7 reports per area.
1) Dir
2) Dir / engineer
3) VP
4) VP / Dir
5) SR VP
6) Preliminary
7) Extra

However the number of plants is growing rapidly.
Currently each area has these 7 reports set up. All
reports have the same information and come from the same
query (per area). As it stands, there is a form which
allows the user to check the reports they want then click
their area button and the reports print. However, since
changes in the report formats are likely, I would like to
have (1) basic report per area and the title to be filled
in according to which check box(s) the user presses. I
would like to stay with the check boxes to select the
different reports. (People in the office seem to handle
check boxes better than click + Ctrl + click for list
boxes).

Thank you for any and all help,

PBrown
 
In the report's Open event, add something like:

select case forms!frmYourForm!OptionBox
case 1
txtBoxTitle = "Report No. 1 Title"
case 2
etc..
 
However the number of plants is growing rapidly.
Currently each area has these 7 reports set up.

Would it perhaps make more sense to store the title in a table, and
include that table in the Report's recordsource?
 
I am not too familiar with "case"'s. At first I was
using individual check boxes and I was able to use a "if"
statement, however, now that I am using an option box, I
am rather lost on the coding and language. The if
button1 = 0 then xxx else if button2=0 then is not
working (I have been told it is because it is in an
option group)... Could you please provide some
explaination for the different parts of the code below?
Thank you for any and all help.
 
It has been suggested to do that, but I get lost on the
coding and how to tell the report which title to use.
Therefore, I am tring to work with an option group.
However, I am open for any suggestions. If you could
give me a brief desc or a place to find an example, I
would appreciate it.

Thanks,
PBrown
 
It has been suggested to do that, but I get lost on the
coding and how to tell the report which title to use.
Therefore, I am tring to work with an option group.

That's a possibility - however, an Option Group has a number as a
value, not a text field!

What you might do is create a small Table, tblTitles, with two fields:
an integer TitleNo and a text field, Title. Type in the numbers from 1
to 7 in the number field and a corresponding title for your report.

Put a textbox on the Report with a Control Source property:

=DLookUp("[Title]", "[tblTitles]", "[TitleNo] = " &
[Forms]![yourformname]![youroptiongroupname])

This will look up the title in tblTitles based on the selected value
of the option group.
 
I have used the following in the control source for the
text box:
=DLookUp("[Title]","[tblTitles]","[TitleNo]=" & [Forms]!
[ReportForm]![ReportOptions])
However, now the report is showing an "#ERROR" in the
textbox designated for the Title.
I made sure that in the tblTitles, the TitleNo is = to the
option value for each radio button in ReportOptions. Can
you direct me as to where I am going wrong?

Thanks,

PBrown
-----Original Message-----
It has been suggested to do that, but I get lost on the
coding and how to tell the report which title to use.
Therefore, I am tring to work with an option group.

That's a possibility - however, an Option Group has a number as a
value, not a text field!

What you might do is create a small Table, tblTitles, with two fields:
an integer TitleNo and a text field, Title. Type in the numbers from 1
to 7 in the number field and a corresponding title for your report.

Put a textbox on the Report with a Control Source property:

=DLookUp("[Title]", "[tblTitles]", "[TitleNo] = " &
[Forms]![yourformname]![youroptiongroupname])

This will look up the title in tblTitles based on the selected value
of the option group.


.
 
I have used the following in the control source for the
text box:
=DLookUp("[Title]","[tblTitles]","[TitleNo]=" & [Forms]!
[ReportForm]![ReportOptions])
However, now the report is showing an "#ERROR" in the
textbox designated for the Title.
I made sure that in the tblTitles, the TitleNo is = to the
option value for each radio button in ReportOptions. Can
you direct me as to where I am going wrong?

The fieldnames and table name match? Is TitleNo a Numeric field? And
is there in fact an open form named ReportForm with an Option Group
control, with a value selected, named ReportOptions?
 
The fields match. Talble names as suggested in previous
post. TitleNo is a numberic field.
Form Name = ReportForm
OptionGroup Name = ReportOptions
Option1 radio button named: rb1
" 2 " " " rb2
" 3 " " " rb3
" 4 " " " rb4
" 5 " " " rb5
" 6 " " " rbc

Where did I go wrong?

Thank you for your continuing help,

PBrown
-----Original Message-----
I have used the following in the control source for the
text box:
=DLookUp("[Title]","[tblTitles]","[TitleNo]=" & [Forms]!
[ReportForm]![ReportOptions])
However, now the report is showing an "#ERROR" in the
textbox designated for the Title.
I made sure that in the tblTitles, the TitleNo is = to the
option value for each radio button in ReportOptions. Can
you direct me as to where I am going wrong?

The fieldnames and table name match? Is TitleNo a Numeric field? And
is there in fact an open form named ReportForm with an Option Group
control, with a value selected, named ReportOptions?



.
 
The fields match. Talble names as suggested in previous
post. TitleNo is a numberic field.
Form Name = ReportForm
OptionGroup Name = ReportOptions
Option1 radio button named: rb1
" 2 " " " rb2
" 3 " " " rb3
" 4 " " " rb4
" 5 " " " rb5
" 6 " " " rbc

Where did I go wrong?

Beats the heck out of me! This all looks perfectly correct, so long as
the Form is open at the time you open the report. Anyone have an idea
what might be amiss?
 
Back
Top