Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my not so humble opinion, parameters are handled badly in MS Access.</p> <p>I think having to enter the values in the query whenever it is run (unless it is a one off experimental query) is just wrong headed. It would be so much easier to automate reports like that if you could just pass the parameters.</p> <p>Typically, I create a report without the parameters in the where clause of the query, and then pass in your own where condition which gets added on <a href="https://stackoverflow.com/a/398854/685">Remou's answer here</a></p> <p>You could also alter the query in the report before you call it, but that's pretty hackey.</p> <p>-- Edit --</p> <p>I see the confusion. I interpreted what you were doing as a report (not a form).</p> <p>What's likely happening is you that when it tries to render/format the print job, it's having to make multiple calls to form's record source. And that why it keeps asking you for that data.</p> <p>From what I understand in your question, you have a query that looks like this:</p> <pre><code>select foo from bar where yaddah_date between [Start Date] and [End Date] </code></pre> <p>And then you've used that query as the record source for a form that you are trying to latter print as a PDF. First of all you should probably create a report that is an analogue of the form. And then open the report for printing with a filter on it:</p> <pre><code>DoCmd.OpenReport "myReport", , , , _ "yaddah_date between " &amp; txtStartDate &amp; _ " and " &amp; txtEndDate </code></pre> <p>(the last part is basically the filter/where clause that report will apply to the results of the query that's generating its data).</p> <p>If you MUST print the form, you can do something similar </p> <pre><code>DoCmd.OpenForm "foo", acNormal, , _ "yaddah_date between " &amp; txtStartDate &amp; _ " and " &amp; txtEndDate </code></pre> <p>Or you can set the <code>filter</code> property of the form/subform.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload