Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form to filter certain records on subsquent report

Posted on 2011-03-07
2
Medium Priority
?
270 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 total points
ID: 35057486
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
ID: 35057574
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
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…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

609 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