The syntax for adding parameters to the report's Parameters collection via the SQL string is:
<%FieldName|PromptString|DefaultValue|Type%>
SELECT * FROM Products INNER JOIN Categories on Products.CategoryID = Categories.CategoryID WHERE Products.SupplierID = <%SupplierID|Enter supplierID|1000%> and OrderDate = #<%Date|Order date: |1/1/2001|D%># and Discount='<%bool|Is this checked?|True|B%>'
Dim rpt as New rptYourReport() rpt.Parameters(0).Value = 1 'A variable which takes its value from your user interface may be passed in here rpt.Parameters(1).Value = #4/1/2003# rpt.Parameters(2).Value = 'False' rpt.Run()
CustOrderHist '<%ID|Enter Customer ID: |AFLKI%>'
ActiveReports will then replace the parameter text "<%...%>" with whatever the user types into the dialog to create a call like this: CustOrderHist 'AFLKI'.
Note: Both main and subreport queries must contain the same field (so the main report must have a CategoryID field and the subreport also must have a CategoryID field.