• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Form to filter certain records on subsquent report

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
seamus99
Asked:
seamus99
1 Solution
 
Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
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
 
JAMcDoCommented:
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now