Here I explain how to set a Access report to a given parameter,through a combo box
Example
Then Create a Query using the Fields that you wish to show
in your report. It looks like that;
Then you have to create a report based on this query, Use Report wizard to do this easily.
Then you have to create a report based on this query, Use Report wizard to do this easily.
This report shows all
the records include in your query.
Lets assume that you want to take customer as your criteria.Based
on that:
Next step is creating a unbound form .Then add a combo box
that will show the Cus_id field as well as Customer_Name .Use Combo wizard to
do this.Set Combo box column property to 2.Hide the Cus_id field by setting the
Combo box’s column Width property to 0’:1’
Make sure the combo box bound column is the Cus_id
Field.Name the Combo box as cboFindName
Then add the command
button to the form. Then under property window click the event procedure
belongs to the button and choose code builder option.
Then under Button Click Event type following code:
Name this Form “ParamForm”
Go back to the query.As criteria,on the query’s Cus_id field criteria line write:
Forms!ParamForm!cboFindName
Code the Report’s open Event :
DoCmd.OpenForm “ParamForm”, , , , , acDialog
Code the Report’s Close Event :
DoCmd.Close acForm, “ParamForm”
Run the report
The Report will open the form
Find the Customer Name in the Combo Box.Click the Command
Button ,When Report is opened click the
refresh button to refresh the report data.
No comments:
Post a Comment