Using OpenArgs with DoCmd.OpenReport
Posted on 2004-10-20
MS Access 2002.
I have a report based on a query that takes parameters. The query currently has direct references to form controls in the SQL. I want to change these to general query parameters to be passed to the query (indirectly via the report) so I can call this report from other forms.
I am trying to use the OpenArgs property in the following way:
DoCmd.OpenReport "rptDailyProductionReport", acPreview, , , , "[pLNO]:='" & cboLine.value & "'"
where pLNO is the parameter within the query and cboLine.value is the value I am trying to pass into the parameter.
The above code is not working (and I have tried many variations of this) but I am constantly getting the input box asking me to provide a value for pLNO.
Also I have multiple parameters to pass so could any code snippets solving this problem please take this into consideration.