Solved

Form to filter certain records on subsquent report

Posted on 2011-03-07
2
258 Views
Last Modified: 2012-05-11
I have a form frmReportMenu that has a command button that the user can click to run a query qry ADP_query_new.
the query includes a field "CustomerID".

What I would like to do is allow the user to specify via a combo box(combo6) to produce the report for only those records that match the CustomerID selected in the ComboBox.

The form that the has the combo is  FrmForm1

one the user selects a value, I would like to execute a CMDPRint via a button on the form.

The report should be displayed with only the records that match the CustomerID value.
0
Comment
Question by:seamus99
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
Comment Utility
You can open a Report with a WHERE argument via the OpenReport method:

DoCmd.OpenReport "YourReportName", acViewPreview, , "CustomerID=" & Me.combo6.Column(0)

If CustomerID is Text data:

DoCmd.OpenReport "YourReportName", acViewPreview, , "CustomerID='" & Me.combo6.Column(0) & "'"

Note that acViewPreview opens the Report in Preview mode. If you want to print it, use acViewNormal (or just remove that argument entirely).
0
 
LVL 3

Expert Comment

by:JAMcDo
Comment Utility
If I understand you correctly, the combo6 combo box is based on the ADP_query_new query.  If so, the combo6 combo box can run/update this query by using the 'On Got Focus' event.  No need for the command button to update ADP_query_new.

Once the user selects the desired value from combo6, and clicks on the CMDPRint button, the report would be called.

The report should be based on a query that has the criteria for CustomerID that looks something like
=[Forms]![FrmForm1]![combo6] .  This filters the query for the desited CustomerID.

J.

0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now