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


David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

One 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:


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.

David

GL Transaction Entry Expand Scrolling Window.zip

This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on http://www.winthropdc.com/blog.

One thought on “Modifier – How to Expand the GL Transaction Entry Scrolling Window Example

Please post feedback or comments

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.