This is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.
I have seen this issue come up a number of times. Trying to automate processes which involve reports and wanting to automate the Report Destination window. Sometimes you can add the Report Destination to Visual Basic for Applications (VBA) and sometimes the system will not add the window to VBA. This post will explain the reason for this “weird” behavior.
One thing about “weird” behavior when it comes to computers, is that once the explanation has been discovered, it all makes perfect sense and the computer is just being logical.
The primary fact for this issue is that there are actually two different Report Destination windows:
- In the Dex.dic. This Report Destination window is part of the runtime engine and is opened when a report is executed without the destination being specified in the Dexterity Run Report code.
- In the Dynamics.dic. This Report Destination window is used by developers to ask for report destination information in advance. This information is then passed to the report writer when the developer calls a report, usually after some sort of temporary file processing.
The first Report Destination window from the runtime cannot be customized by VBA or Dexterity. You cannot add it to VBA and you cannot register a Dexterity trigger against it. [Edit] In the more recent builds of Dexterity it is possible to register a cross dictionary trigger against the Dex.dic using Dictionary ID = 1.
The only interactions that are possible with this window are by using the VBA’s SendKeys command to control using keyboard key strokes or using pass through Dexterity sanScript.
The Dex.dic can be referenced as dictionary 1 with the execute() function or the unsupported method of calling Dexterity from VBA via the Continuum Integration Library. Please see the materials in the following post for more information on these methods:
The second Report Destination window which is part of the core Dynamics.dic application dictionary and can be referenced easily by both VBA and Dexterity.
I hope this explains the apparent inconsistent behavior.
10-Jan-2011: Mention that cross dictionary triggers against Dex.dic are possible now.
This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.