title: How to collect input via a form and pass to report query in Access
body: <p>I have an Access 2003 MDB where I would like to present a small form for the user to input two parameters "Start Date" and "End Date". Thanks to another Stack Overflow user ("Kevin Ross"), I learned how to embed the form control directly in the query that is used by the report I would like to display.</p>
  
  <pre><code>SELECT q1.CasesAssigned, q2.WarningsIssued  
  FROM 
      (SELECT COUNT(*) AS CasesAssigned 
      FROM vwCaseDetail 
      WHERE DateAssigned Between [Forms]![frmReporting]![txtStartDate] 
          AND [Forms]![frmReporting]![txtEndDate]) as q1,  
      (SELECT COUNT(*) AS WarningsIssued 
      FROM vwWarningDetail 
      WHERE DateIssued Between [Forms]![frmReporting]![txtStartDate] 
          AND [Forms]![frmReporting]![txtEndDate]) as q2
  </code></pre>
  
  <p>I have tried two different ways to open the report and pass the users input:</p>
  
  <ol>
  <li><p>After the user enters parameters I call <code>DoCmd.OpenReport "myReport", acViewPreview</code>. The problem here is that the reports opens and close so fast I never even see it. Ideally I would like to close the input collection form and then open the report.</p></li>
  <li><p>Inside the <code>Report_Open</code> event I have code that opens the form that collect the users input. The input collection form opens, however I still get prompted by the report to enter in the two parameters. The report does not seem to be gathering the parameters from the input collection form.</p></li>
  </ol>
  
  <p>Any suggestions on the proper way to pass data collected on a form to a report? Thank you.</p>