By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,223 Members | 1,608 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,223 IT Pros & Developers. It's quick & easy.

How do I have a report ask for parameters just one time?

P: 18
I have 2 queries each with parameters to select month and year [Enter Month #] and [Enter Year]. Both do exactly as I want. When I run a reports based on the 2 queries they work great. How do I run both queries in one report and have it ask for the parameters just once? One report is run as a subreport.
Aug 6 '09 #1

✓ answered by ajalwaysus

I would suggest you put a form in front of the report with the date fields as text boxes, that way you can tie the queries to the text boxes and they will inherit the dates on load.
i.e.
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM TABLE1 WHERE StartDate = Forms!MyForm!txtStartDate.Value
I don't think there is another way because your quires are independent, and therefore need independent data entry.

Share this Question
Share on Google+
6 Replies


Expert 100+
P: 266
I would suggest you put a form in front of the report with the date fields as text boxes, that way you can tie the queries to the text boxes and they will inherit the dates on load.
i.e.
Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM TABLE1 WHERE StartDate = Forms!MyForm!txtStartDate.Value
I don't think there is another way because your quires are independent, and therefore need independent data entry.
Aug 6 '09 #2

P: 18
Ok, I created a form that asks for month # and year with a comand button that opens the report and enters the entered month and year for the queries. Everything works great except the report automatically prints and never opens. It prints the correct information. How do I fix it so it just opens the report to review and then can be printed by clicking on print?
Aug 6 '09 #3

P: 18
I should have added the code for the comand button

Private Sub Command14_Click()
Me.Visible = False
DoCmd.OpenReport "Incident Report by Month", acViewNormal, acEdit
DoCmd.Close acForm, "Report by Month"

End Sub
Aug 6 '09 #4

Expert 100+
P: 1,287
Try
DoCmd.OpenReport "Incident Report by Month", acViewReport
Aug 6 '09 #5

P: 18
Thanks for the responses. ChipR I tried this code and it does the same thing.
Aug 7 '09 #6

P: 18
acViewPreview is what I needed, thanks for the help
Aug 10 '09 #7

Post your reply

Sign in to post your reply or Sign up for a free account.