Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I want to use a form control to set the parameter for a report

Status
Not open for further replies.

GoingCrazy

Technical User
May 7, 2001
30
US
I've set up a combo box on a form that lists shop codes and their descriptions. I want to be able to select a code that becomes the parameter in a query that feeds a report. I was then hoping I could just click on a button to "Get Report" and the report would show all the records for the shop code selected.

If this is possible, I would appreciate any help.

Thanks
 
Crazy:

Yes, it is possible.

Since you already have the form created, your next step is to create the query.

Set it up as you would any query and in the criteria cell for the shop code you need to reference the combo box on your form:

Forms!frmName.cboName

Now create a report based on the query.

Put a command button on your form to open the report. You might also want to put some test code in to make sure a selection has been made in the combo box:

If Not IsNull(cboName) Then
DoCmd.OpenReport "rptName", acPreview
Else
MsgBox "You must select a Shop ID",
vbOKOnly, "Header"
cboName.SetFocus
End If

When the user selects a shop ID and then clicks on the Open Report button, the report opens, calls the query which looks at your form/combo box for the parameter.

Hope that helps.
Larry De Laruelle
larry1de@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top