By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,466 Members | 2,140 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,466 IT Pros & Developers. It's quick & easy.

Drop-down reporting?

P: n/a
El
I have a table called Product Code Master with fields Product_Code and
Description. Currently I have individual reports set up for different
types of products and the user simply clicks a macro button for the
report type they need on Frm_Open and type in the product code they are
looking for.

Is there a way I can eliminate the user choosing which report to print
and some how have a drop down list where they could chose the product
code they need and the report for that item in the correct report
format appears? Example: User needs information for Report 1, XXXX.
If they choose XXXX from the drop-down, then Report 1 would appear.

Any suggestions would be great!

Jul 25 '06 #1
Share this Question
Share on Google+
5 Replies


P: n/a
If the format/layout for the reports is the same, why not just filter
the report in the Open event? Just specify a valid filter when you
open the report

Jul 26 '06 #2

P: n/a
El

pi********@hotmail.com wrote:
If the format/layout for the reports is the same, why not just filter
the report in the Open event? Just specify a valid filter when you
open the report
That's part of my problem; the format/layout is different for each
report.

Jul 26 '06 #3

P: n/a
Do you have a FieldName, like "ProductType" that you can use to
determine what report to use? otherwise, your code for determining
what report to open will never stop growing. If you had the reportname
and/or the category in one of the hidden columns in the dropdown, you
could just reference that.

docmd.openreport "MyReport",,,ProductType=cboChooseReport.Columns(2 )

Jul 27 '06 #4

P: n/a
El

pi********@hotmail.com wrote:
Do you have a FieldName, like "ProductType" that you can use to
determine what report to use? otherwise, your code for determining
what report to open will never stop growing. If you had the reportname
and/or the category in one of the hidden columns in the dropdown, you
could just reference that.

docmd.openreport "MyReport",,,ProductType=cboChooseReport.Columns(2 )
Okay, I added a FieldName called ProductType. I tried entering the
command you listed above in my dropdown and it gives me runtime error
424 and says something about no object. I put the name of my report in
the place of "MyReport". Is there something additional I need to add
to the command? I'm not very good at codes. Thanks for your help!

Jul 27 '06 #5

P: n/a
Did you have a look at Northwind?

Option Compare Database ' Use database order for string comparisons.
Option Explicit ' Requires variables to be declared before they are
used.
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
' This procedure used in Preview_Click and Print_Click Sub
procedures.
' Preview or print report selected in the ReportToPrint option
group.
' Then close the Print Sales Reports Dialog form.

Dim strWhereCategory As String

'---SET THE FILTER FOR THE REPORT....
strWhereCategory = "CategoryName = Forms![Sales Reports
Dialog]!SelectCategory"

Select Case Me!ReportToPrint
Case 1
DoCmd.OpenReport "Employee Sales by Country", PrintMode
Case 2
DoCmd.OpenReport "Sales Totals by Amount", PrintMode
Case 3
If IsNull(Forms![Sales Reports Dialog]!SelectCategory) Then
DoCmd.OpenReport "Sales by Category", PrintMode
Else
DoCmd.OpenReport "Sales by Category", PrintMode, ,
strWhereCategory
End If
End Select
DoCmd.Close acForm, "Sales Reports Dialog"

Exit_Preview_Click:
Exit Sub

Err_Preview_Click:
Resume Exit_Preview_Click

End Sub

<straight outta the DB...

Jul 27 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.