You have built the report already. It has a name in the section of your database where all the Tables, Queries, Reports etc are listed. That's the name you'll use to close the report.
You're probably confusing the Caption of a report to its Name.
Sorry, I have given you the wrong end of the stick. Let me try and explain more clearly
Lets say that I have Report A, Report B, Report C and Report D, each of which open with their related query; the criteria in each of those queries is the same (between start date and end date, with one other field =True)
I am trying to have it so that there is a form that contains buttons, each relating to the report that it runs (so a button each for Report A, Report B etc).
The idea is that the user will click on their desired button (lets say Report B), and then in turn the following happens
- The Date Selector Form opens
- User puts in start and end dates using date pickers then presses OK
- Report runs taking the start and end date from the Date Selector Form which is open
- Date Selector Form closes
All of the code relating to the above process is in the OnClick event for the report button of their choice (Report B)
So far, that works just fine, and the reports are displaying without issue,
The problem I have is that if the user clicks on the 'Cancel' button, it's code is to close the Date Selector Form - this works in as much that it closes the form, however the report/query continues from the process above and as the Date Selector form has now closed, it puts up Input Boxes asking for the parameters to be entered. If the user clicks on the Cancel button on these Input boxes, it then brings up the VBA error window.
I have been having another go (I might not be knowledgeable, but I am determined

), and have now set the OnClick event for the Cancel button to run a macro called 'CancelDateSelector' - this closes the Date Selector form and then the next step is to 'StopAllMacros' - - this halts the report process, but still leads to the VBA error window showing an error 2501 and three buttons (End, Debug & Help)
I could have a Date Selector form for each report, with the OpenReport command being the OnClick event of the OK button of that particular Date Selector form, but that would be fairly horrendous as there is no less than 138 different reports - hence looking for some sort of generic 'close this window and halt the prior action' so I can use one form for the lot
I'm just wondering - what about if I set the OnClick event to set the textbox values to Null, then allow the remainder of the process to take place as it would if there were dates in the box, then let the null values close the report (as per the error handling above) and then make the last command for the button that kicks off the process (Report B button, if following the example above) to close the DateSelector Form?