Choose Report through command button

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

Guest

Hi!

I have one form with 4 sequential combos: CboType, Cbo2, Cbo3 and Cbo4.
In the end of the research, one listbox shows us the result.
In adition, I have 5 Reports, one for each Type, chosen in the CboType.
Each Type has different fields, therefore, different Reports.
It would like:
With one command button in form, in the end of the research,
to open the corresponding Report to the Type chosen in the Cbo1.

Thanks in advance.
an
 
One solution: In your RowSource for cboType, have a column with the name of
the report desired. You don't need to display it and can set it's column
width to zero. If it is the 3rd column in your RowSource your code on the
click event of the Cmd button could be:

DoCmd.OpenReport cboType.Column(2)

The column index is zero-based which means that column(2) is the third
column.
HTH
 
smK23,

Thanks for your reply.

I am a little confused because in the RowSouce of query I have:

SELECT DISTINCT Q_MultiField.Type FROM Q_MultiField ORDER BY
Q_MultiField.Type;

an
 
Can you add a column to the table Q_MultiField and put the name of the
report to call there?
Then change the RowSource to "SELECT DISTINCT Q_Mutifield.Type,
Q_Multifield.ReportName FROM ..."

Change the number of columns to 2
set the column width of the second item to zero.
Since you only have two columns, you would use

DoCmd.OpenReport cboType.Column(1)
 
But I have 4 different reports, because they are differents fields,
consonant the type...
an
 
I understood from your original post that each selection in cbotype had a
different report:
In adition, I have 5 Reports, one for each Type, chosen in the CboType.

Do you have 5 items in your list for cboType, and are each of those items
associated with a different report? If that is not the case, you will need a
different solution.

In the code for your command button:
You can use a "SELECT Case" statement and specify the parameters required to
select the desired report.
 
Is correct.
I have one form for each Type.

My dificult is write the code on cmd to choose exactlty If IdType1 ("hidden"
in cboType) then R_Type1, IfIdType2 then R_Type2,...

In adition: My CboType has Type and IdType fields with column count=2,
column widths=1cm;0cm and bound column=1

Thanks
an
 
Back
Top