This could be an SDK issue, but we have a reconciliation report with about 30 Dataproviders.
Some of those Dps will not return any data depending on the month they are run, but because of the message being displayed we have to stay by the PC while refreshing the document to click OK at each one of those messages.
Is there a way to suppress those message within Reporter or programmatically like the “DoCmd.SetWarnings False” in Access? This would mean that we could let the report refresh overnight.
There is one more way to avoid “No Data Fetch” message. Have some sort of union query which will return 1 null row of data no matter what happens to the Main Query.
The problem with going by the SDK way is if there some prompts in the Document they will not be prompted since the Interactiveness has been set to False. So you have take care of that as well.
We thought about the union query returning null, but unfortunately we have 12 reports with more than 30 Dps in them, so it would be quite a task to update every single query…
The good thing is that we don’t have any prompts, every queries return the last month data. So I have just added the following piece of code
Private Sub Document_AfterRefresh()
Application.Interactive = True
End Sub
Private Sub Document_BeforeRefresh(Cancel As Boolean)
Application.Interactive = False
End Sub
I am not very familiar with VBA Macros: I tried to implement above solution, but for whatever reason I am still getting prompted with the message “No Data to Fetch…”.
Please, can someone walk me through step by step how to setup this macro?
If you copy this code into the ThisDocument module, it should work. As has been stated, it not only suppresses the “No Data to Fetch…” message, but any prompts and so forth are also suppressed. It even turns off the hourglass cursor, so it can be confusing to the user.
Private Sub Document_BeforeRefresh(Cancel As Boolean)
Application.Interactive = False
End Sub
Private Sub Document_AfterRefresh()
Application.Interactive = True
End Sub
Note that this code is executed only when a full refresh is performed. If you run queries individually (from the query panel or Data Manager) the above events are not triggered.
To implement the little bit of code, you will need to have your Report which gives you the No Data to fetch message open.
Click on Alt + F11, and the Visual Basic Editor will open.
On the left hand side you should see a list of all the document you have open, under the name of the document which gives you the message you will see a Icon called ThisDocument: double click on it and on the main window a blank sheet should appear.
On it paste the little bit of code:
Private Sub Document_AfterRefresh()
Application.Interactive = True
End Sub
Private Sub Document_BeforeRefresh(Cancel As Boolean)
Application.Interactive = False
End Sub
Then if you refresh the document in Reporter, you shouldn’t see the message anymore…
Yes, that’s happened to me before as well. You craft a nice, clear response, only to find out that someone answered before you did. Actually, you covered some things that I didn’t, as well as confirm that this approach should definitely work.