Modifier – How to Expand the GL Transaction Entry Scrolling Window Example

David Meego - Click for blog homepageOne of the customisations that I have heard requests for a number of times is to open the General Ledger Journal Entry (GL Transaction Entry) window's scrolling window (grid) to its expanded state when the window is opened.

The method to make this happen is to use Visual Basic for Applications (VBA) to "press" the expand button as though the user has clicked on the button.  However, when most people try to create this customisation, they end up receiving the following error message.

Run-time error '1008': Unsafe Operation. An attempt was made to set a value into an application field which is disabled. This operation could compromise the integrity of the application. 

This is because the "button" that we see is actually a non editable visual switch field used to display the graphic icon.  The actual button that we need to press is an editable, but hidden field.  Additional steps are needed to temporarily make the field visible so that it can be added to VBA.

The Knowledge Base (KB) articles below discuss this issue further and provide the steps to create the working customisation:

Error message when you expand a scrolling window by using VBA in Microsoft Dynamics GP: "Run-time error '1008': Unsafe Operation" (KB 951231) Secure Link

How to add a hidden field by using Modifier together with Visual Basic for Applications in Microsoft Dynamics GP (KB 951230) Secure Link

There is another unsupported method which you can use achieve the same result.  This method works by adding another visible field to VBA as a placeholder, and then editing the exported package to change the placeholder field details to the actual hidden field we need to reference.

  1. Log into Microsoft Dynamics GP. Click Transaction, click Financial, click General to display the Transaction Entry window.

  2. From the menu, click Tools, click Customize, click Add Current Window to Visual Basic.

  3. From the menu, click Tools, click Customize, click Add Field to Visual Basic. The mouse cursor will change.

  4. Click on the Expand Button to add the 'Scroll Expand Switch' field to VBA.
    Note: This is adding the wrong field to VBA, however the steps below will change the field to the correct one.

  5. Press the Esc key to turn off Add Field mode.

  6. Close the Transaction Entry window.

  7. From the menus, click Tools, click Customize, click Customization Maintenance.

  8. Select the GL_Transaction_Entry window and click Export to export it as a package.  
    Note: Export a second package as a backup in case there is an issue with the changes made in the following steps.

  9. Open Notepad.exe and drag and drop the saved package file into the Notepad window.

  10. Find the reference to the Visual Switch 'Scroll Expand Switch' field, shown below:
        WindowField "Scroll Expand Switch"    
         ArrayIndex "0"
         DisplayName "ScrollExpandSwitch"
         Local "false"
         ProgrammerName "Scroll Expand Switch"

  11. Edit the references to change the field to the desired hidden field, in our case the Push Button 'Scrolling Window Shrink'.  The Display name should be the same name with the spaces removed. The result is shown below:
        WindowField "Scrolling Window Shrink"    
         ArrayIndex "0"
         DisplayName "ScrollingWindowShrink"
         Local "false"
         ProgrammerName "Scrolling Window Shrink"

  12. Close Notepad.exe and save the updated package.

  13. Back in Microsoft Dynamics GP, from the Customization Maintenance window, click Import, click Browse and click Local Files. Open the updated package, click OK and click OK again to the overwrite warning.

  14. From the menu, click Tools, click Customize, click Visual Basic Editor.

  15. In the Visual Basic Editor, locate the TransactionEntry (Window) module under the Microsoft_Dynamics_GP project. Double click on the module and enter the following code:
     Private Sub Window_AfterOpen()
         ScrollingWindowShrink = 1
         Me.Changed = False
     End Sub
    Note: Setting the Me.Changed flag to False avoids the Save/Discard/Cancel dialog appearing when the window is closed without any changes being made.

  16. Return to Microsoft Dynamics GP.

  17. Click Transaction, click Financial, click General to re-open the Transaction Entry window. The window will now open without errors and with the scrolling window expanded.


Example code for v8.0, v9.0 & v10.0 is attached at the bottom of the article.

Please see the "Installation Instructions.txt" file in each version's archive for more information.


GL Transaction Entry Expand Scrolling

Comments (1)
  1. David Musgrave says:

    Post from Jivtesh Singh at About Dynamics, Development and Life…/dynamics-gp-customizations-best.html

Comments are closed.

Skip to main content