title: Access DoCmd.OpenReport Where condition issue
body: <p>I'm trying to print a report, like a invoice. But I have an issue with the Cmd.OpenReport Function.</p>
  
  <p>I have a query for that invoice with a parameter.</p>
  
  <pre><code>SELECT EMPLEADOS.CODIGO, EMPLEADOS.NOMBRE, PAGOS.Fecha, PAGOS.Descripcion,
         CONCEPTOS.Descripcion, DETALLE_PAGOS.Monto
  FROM ((EMPLEADOS INNER JOIN PAGOS ON EMPLEADOS.CODIGO = PAGOS.EmpleadoID)
        INNER JOIN DETALLE_PAGOS ON PAGOS.IDPago = DETALLE_PAGOS.IDPago)
        INNER JOIN CONCEPTOS ON CONCEPTOS.ConceptoID = DETALLE_PAGOS.Concepto
  WHERE PAGOS.IDPago = [COD_PAGO];
  </code></pre>
  
  <p>I join this query with a report. When I open the report, I have to type the ID of the invoice.</p>
  
  <p><a href="https://i.stack.imgur.com/9xsGq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9xsGq.png" alt="enter image description here"></a></p>
  
  <p>That is OK. But I have to print this report with a Form, I have created a Button to print, and the code is </p>
  
  <pre><code>Private Sub txtPrint_Click()
  If MsgBox("¿Deseas imprimir?", vbYesNo) = vbYes Then
      //OTHER FUNCTIONS
  
      DoCmd.OpenReport "ReportePago", acViewPreview, , "[COD_PAGO]=" &amp; IDPago.Value
  
  End If
  </code></pre>
  
  <p>End Sub</p>
  
  <p>IDPago.Value -> I have a hidden TextBox that store the id of invoice.
  But when I click on print button again appear the message box </p>
  
  <p><a href="https://i.stack.imgur.com/1Ub3L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1Ub3L.png" alt="enter image description here"></a></p>
  
  <p>If I insert the id of the invoice, print the report, but I don't want to insert the id to print. What can I do to solve this?</p>
  
  <p>Thanks.</p>