How to link 3 different combo boxex in a form (as report criteria) to the report

  • Thread starter Thread starter Hart
  • Start date Start date
H

Hart

I would like to use 3 combo boxes in a form as parameter
criteria for a report.
When I open a report, there will be a pop up form with 3
combo boxes. I am already able to link the report to the
form. However after the user select the content of all 3
combo boxes and then click the preview report command
button, I would like to be able to open the report based
on the selected option from the 3 combo boxes. Currently
after clicking the preview command button in the form with
combo box, the report can be opened but it shows all the
data, not the specific data based on the criteria selected
from the combo box in the form.
Thus, how to link 3 different combo boxex in a form (as
report criteria) to the report?
Can anyone help me with this please? I will really
appreciate your response in this.

Thanks,
Hart
 
ps. To refer to a value on the form, the form must be open. I assume you are opening the
form from the report with the "acDialog" window mode argument since this will halt the
code and the opening of the report until you are done with the form. The code will
continue when the form is closed or hidden, in this case you need hidden (Visible=No)
because the form has to be open to read the combo boxes.
 
Hi guys. I realy need to learn how to link 3 diffrent combox boxes to the report. Could u guys post the code that is passing the combo box criteria to the report query.Thanks
 
One way is to link the combo box in the form to the record source of the report
Select * From MyTable Where [Field1] = forms![FormName]![Combo1Name] And
[Field2] = forms![FormName]![Combo2Name] And [Field3] =
forms![FormName]![Combo3Name]

The second way is to pass the parameters through the open report line command

docmd.OpenReport "ReportName",,,"[Field1String] ='" &
forms![FormName]![Combo1Name] & "' And [Field2Number] = " &
forms![FormName]![Combo2Name] & " And [Field3String] = '"
forms![FormName]![Combo3Name] & "'"

The string should come with the ' symbol before and after the parameter.
 
=?Utf-8?B?T2Zlcg==?= said:
One way is to link the combo box in the form to the record source of the report
Select * From MyTable Where [Field1] = forms![FormName]![Combo1Name] And
[Field2] = forms![FormName]![Combo2Name] And [Field3] =
forms![FormName]![Combo3Name]

The second way is to pass the parameters through the open report line command

docmd.OpenReport "ReportName",,,"[Field1String] ='" &
forms![FormName]![Combo1Name] & "' And [Field2Number] = " &
forms![FormName]![Combo2Name] & " And [Field3String] = '"
forms![FormName]![Combo3Name] & "'"

The string should come with the ' symbol before and after the parameter.

"tonyck" wrote:

>
> Hi guys. I realy need to learn how to link 3 diffrent combox boxes to
> the report. Could u guys post the code that is passing the combo box
> criteria to the report query.Thanks
>
>
> --
> tonyckPosted from https://www.pcreview.co.uk/ newsgroup access
>
>
Thank u for u reply. Well could u tell me where should i place the two methods code in ? i be happy if show me how to write the on click event .Thanks
 
Back
Top