Solved

Form to filter certain records on subsquent report

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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

786 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