Filter the information on the reports

emsadoon

Registered User.
Local time
Today, 15:10
Joined
Jun 6, 2013
Messages
83
I have a subform in a main form. I want to put those new added items in the subform (or the selected ones if possible) to be appeared in a report with other information that is coming from other tables. So, my approach to this matter so far, was to create a query and then used that as source for my report. In the query criteria I also put Date() to only show the data that was entered today. But my problem is that I want to have a report button right on the main form, to only print items regarding to that form along with other related info coming from query. I greatly appreciate it if you can guide me on this matter.
 
Try adding that criteria to your Reports recordsource.. Something along the lines of..
Code:
SELECT theFields FROM theTable
WHERE dateField = Date() AND theIDField = Forms!mainForm!controlName;
 
Thanks a lot Paul. I put that criteria in the record source and it works. But, every time I open the report, a parameter page pops up and asks me about an ID. Is there a way that when I click on the report button on a mainform, it automatically reads the mainform ID and open the form only related to that.
 
Sorry, I was wrong. The approach you mentioned was enough. I had extra filtration in my report settings as well, that was the reason it was not working. So I just removed that condition and it works perfectly.
Thanks again.
 
What is your current RecordSource? If you have set up the query as I have shown it will look for the ID from the mainform, provided the MainForm is still open.. If it is closed then it will prompt you to put the ID.. IS this the scenario you are having?
 
You are completely right. I previously had a condition in my report's button settings. So I removed that, and now it perfectly works.
 

Users who are viewing this thread

Back
Top Bottom