View report from Drop Down List

G

Guest

Hi all..

I know I have seen this before..but I could not find it.. So know I am
asking.

I have a table setup: tblReports

ReportName: has the names of reports:rpt20042005, rpt2005only etc
DisplayName: Displays a friendlier view: Report 2004-2005 only Report 2005
only etc

I then have a form with a combo box. I can get the combo box to look up the
table and display just the displayname:

SELECT [tblReports].[DisplayName]
FROM [tblReports]
ORDER BY [DisplayName];

I would then like a button to view or print what is selected in the combo box.
view button
print button

How do I do this.

Thanks agian
R~
 
G

Guest

Return both columns to your combobox:
SELECT [tblReports].[DisplayName], [tblReports].[ReportName]
FROM [tblReports]
ORDER BY [DisplayName];

In the ColumnWidths property of the combobox, hide the second column:
1"; 0"

In the button's click event put:

Docnd.OpenReport Me.cboReports.Column(1), acViewNormal

Column(1) returns whatever is selected in the second column.

HTH,
Barry
 
G

Guest

Barry ...

You are the Man... Thank you very much for your help.. That is what I was
doing wrong..it was referancing the displayname not the report name....
Fixed it and now it is working like a charm...

Thank you very very much
R~

Barry Gilbert said:
Return both columns to your combobox:
SELECT [tblReports].[DisplayName], [tblReports].[ReportName]
FROM [tblReports]
ORDER BY [DisplayName];

In the ColumnWidths property of the combobox, hide the second column:
1"; 0"

In the button's click event put:

Docnd.OpenReport Me.cboReports.Column(1), acViewNormal

Column(1) returns whatever is selected in the second column.

HTH,
Barry

Rhett_Y said:
Hi all..

I know I have seen this before..but I could not find it.. So know I am
asking.

I have a table setup: tblReports

ReportName: has the names of reports:rpt20042005, rpt2005only etc
DisplayName: Displays a friendlier view: Report 2004-2005 only Report 2005
only etc

I then have a form with a combo box. I can get the combo box to look up the
table and display just the displayname:

SELECT [tblReports].[DisplayName]
FROM [tblReports]
ORDER BY [DisplayName];

I would then like a button to view or print what is selected in the combo box.
view button
print button

How do I do this.

Thanks agian
R~
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top