View Full Version : Report & Update Query Based on Parameter


Carmen
01-04-2002, 01:27 PM
Hi Everyone!
I have a report called Confirmation Letter based on a parameter query. The parameter asks for Section ID. I also have an update query based on the same parameter query. The update query updates a date field in my table, called ConfirmLetterSent, with the date the report (Confirmation Letter) was run. I call the update query from the On Close event in the report. My problem is that when I open the report I'm prompted to enter the parameter (which is fine). But when I close the report, I'm prompted to enter the parameter again for the update query. Is there any way to save the value of the parameter and not have to enter the information twice? Any help would be appreciated!

Capilano
01-04-2002, 01:56 PM
What you ask is not a difficult task. I just have one question. When you open the Report... do you ALWAYS want to update the record in your table that you responded? For example, what if you open the Report, then decide you really do not want to sent or log a confirmation date in your Table. If you ALWAYS want to have a confirmation date updated, then there is no problem, but if it is intermittent than you may find that you DO want to be notified if you want to update the Recordset.

Pat

Pat Hartman
01-04-2002, 06:07 PM
The report is running two queries. One as the recordsource of the report and a second to do the update. That is why you are being prompted twice. To avoid this problem, create a form where the date is entered, then in both queries refer to the unbound form field to obtain the parameter rather than prompting for it.

....
Where SectionId = Forms!YourFormName!YourControlName;

Carmen
01-07-2002, 05:39 AM
Thanks for you input everyone. Capilano, I do want to update the table every time the letter is run. The report is actually a letter that will be mailed to a recipient, so the letter won't be pulled up until time for mailing. So we just need to know who's been sent a letter and who hasn't. I'm going to try Pat's solution but if you have another idea, I'd love to hear it. Thanks!
Carmen