Solved

Form to filter certain records on subsquent report

Posted on 2011-03-07
2
262 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 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

756 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