Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

How to add a hidden field by using Modifier with Visual Basic for Applications in Microsoft Dynamics GP


View products that this article applies to.

INTRODUCTION

When you use Modifier with Visual Basic for Applications (VBA) to customize forms in Microsoft Dynamics GP and in Microsoft Business Solutions – Great Plains 8.0, you may want to add a hidden field to VBA. Hidden fields can contain code or values that a VBA customization can access.



The following list describes examples of hidden fields:
  • The Display Existing Record field exists in many transaction windows and in many maintenance windows. The Display Existing Record field is set to True when you edit a previously saved record.
  • The hidden shrink buttons and expand buttons (known as grids in VBA) exist in some scrolling windows. The hidden shrink buttons and expand buttons are frequently implemented by using a non-editable Visual Switch control to display the icon and by using a hidden Push Button control that contains code to change the state of the window.

↑ Back to the top


More Information

The following steps show how to add a hidden field by using VBA. This hidden field automatically expands the scrolling window when you open the General Ledger Transaction Entry window.
  1. On the Transactions menu, point to Financial, and then click General. If you receive the following error message, click End:
    Run-time error ‘1008’
    A period before the name of the window indicates that the window is modified. If the window is modified, go to step 11.

  2. On the Tools menu, point to Customize, and then click Modify Current Window.

  3. Locate the Scroll Expand Switch icon. This icon has two down arrows.
  4. Move the Scroll Expand Switch icon to an empty area of the window.
  5. Click the Scroll Shrink Switch icon. This icon has two up arrows.
  6. In the Properties window, click Visual.
  7. Verify that the Visible field has a status of True. If the Visible field has a status of False, double-click the Visible field to change the status to True.
  8. Close the Window: GL_Transaction_Entry window. When you are prompted to save changes to the window layout, click Save, and then click OK in the Form Definition window.
  9. On the File menu, click Microsoft Dynamics GP or Microsoft Business Solutions – Great Plains.
  10. Grant security to the modified window. To do this, follow the appropriate step.


    Using security in Microsoft Dynamics GP 10.0
    1. On the Microsoft Dynamics GP menu, point to Tools, point to Setup, point to System, and then click Alternate/ Modified Forms and Reports.
    2. In the ID list, click the appropriate ID, and then click Microsoft Dynamics GP in the Product list.
    3. In the Type list, click Windows.
    4. Expand the Financial node, and then expand the Transaction Entry node.
    5. Select Microsoft Dynamics GP (Modified), and then click Save.

    Using Advanced Security in Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0
    1. On the Tools menu, point to Setup, point to System, and then click Advanced Security.
    2. In the View list, click by Alternate, Modified, and Custom.
    3. Expand Microsoft Dynamics GP or Great Plains.
    4. Expand Forms, expand Financial, and then expand Transaction Entry.
    5. Select Microsoft Dynamics GP (Modified) or Great Plains (Modified).
    6. Click Apply, and then click OK.



      Note By default, when you start the Advanced Security tool, the current user and the current company are selected. Any changes that you make affect the current user and the current company. However, you can select additional users in the Users area of the Advanced Security window. You can select additional companies in the Company Name area of the Advanced Security window.

    Using the standard security tool in Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0
    1. On the Tools menu, point to Setup, point to System, and then click Security.
    2. If you are prompted, type the system password in the Please Enter Password box, and then click OK.
    3. In the User ID list, click an ID.
    4. In the Type list, click Modified Windows.
    5. In the Series list, click Financial.
    6. In the Access List box, double-click the window that you modified, and then click OK.



      Note An asterisk (*) appears next to the window name.
  11. Follow the appropriate step:
    • In Microsoft Dynamics GP 10.0, point to Tools on the Microsoft Dynamics GP menu, point to Customize, and then click Visual Basic Editor.
    • In Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0, point to Customize on the Tools menu, and then click Visual Basic Editor.
  12. Expand Microsoft_Dynamics_GP or Microsoft Great Plains, and then double-click TransactionEntry (Window).
  13. Change the EventMode property to 1 – emModifiedOnly.
  14. Click File, and then click Close and Return to Microsoft Dynamics GP or Close and Return to Microsoft Great Plains.
  15. If the Transaction Entry window is open, close it.
  16. Click Transactions, point to Financial, and then click General. If you receive the following error message, click End:
    Run-time error ‘1008’
  17. On the Tools menu, point to Customize, and then click Add Fields to Visual Basic.
  18. Click the space where the Expand button was originally located, and then press ESC to turn off Add Field mode.
  19. On the Tools menu, point to Customize, and then click Visual Basic Editor.
  20. Expand Microsoft_Dynamics_GP or Microsoft Great Plains, and then double-click TransactionEntry (Window).
  21. In the TransactionEntry (Code) window, enter the following code:
    Private Sub Window_AfterOpen()
    ScrollingWindowShrink = 1
    Me.Changed = False
    End Sub

  22. If the Transaction Entry window is already modified, go to step 23. If the Transaction Entry window is not modified, change the EventMode property to 0 – emOriginalOnly.
  23. Click File, and then click Close and Return to Microsoft Dynamics GP or Close and Return to Microsoft Great Plains.
  24. Close the Transaction Entry window.
  25. If the Transaction Entry window is modified, go to step 26. If the window is not modified, follow the appropriate step to change security settings.


    Using security in Microsoft Dynamics GP 10.0
    1. On the Microsoft Dynamics GP menu, point to Tools, point to Setup, point to System, and then click Alternate/ Modified Forms and Reports.
    2. In the ID list, click the appropriate ID, and then click Microsoft Dynamics GP in the Product list.
    3. In the Type list, click Windows.
    4. Expand the Financial node, and then expand the Transaction Entry node.
    5. Select Microsoft Dynamics GP (Modified), and then click Save.
    Using Advanced Security in Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0
    1. On the Tools menu, point to Setup, point to System, and then click Advanced Security.
    2. In the View list, click by Alternate, Modified, and Custom.
    3. Expand Microsoft Dynamics GP or Great Plains.
    4. Expand Forms, expand Financial, and then expand Transaction Entry.
    5. Click to select Microsoft Dynamics GP (Modified) or Great Plains (Modified).
    6. Click Apply, and then click OK.



      Note By default, when you start the Advanced Security tool, the current user and the current company are selected. Any changes that you make affect the current user and the current company. However, you can select additional users in the Users area of the Advanced Security window. You can select additional companies in the Company Name area of the Advanced Security window.
    Using the standard security tool in Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0
    1. On the Tools menu, point to Setup, point to System, and then click Security.
    2. If you are prompted, type the system password in the Please Enter Password box, and then click OK.
    3. In the User ID list, click an ID.
    4. In the Type list, click Modified Windows.
    5. In the Series list, click Financial.
    6. In the Access List box, double-click the window that you modified, and then click OK.



      Note An asterisk (*) appears next to the window name.
  26. Follow the appropriate step:
    • In Microsoft Dynamics GP 10.0, point to Tools on the Microsoft Dynamics GP menu, point to Customize, and then click Modifier.
    • In Microsoft Dynamics GP 9.0 and in Microsoft Business Solutions – Great Plains 8.0, point to Customize on the Tools menu, and then click Modifier.
  27. Follow the appropriate step:
    • In Microsoft Dynamics GP 10.0 and in Microsoft Dynamics GP 9.0, click Microsoft Dynamics GP in the Product list, and then click OK.
    • In Microsoft Business Solutions – Great Plains 8.0, click Microsoft Great Plains, and then click OK.
  28. Click Forms, and then click GL_Transaction_Entry.
  29. Follow the appropriate step.
    • If the Transaction Entry window is modified, follow these steps:
      1. Click Open, and then double-click GL_Transaction_Entry.
      2. Click the Scrolling Window Shrink icon.
      3. In the Properties window, click Visual.
      4. Verify that the Visible field has a status of False. If the Visible field has a status of True, double-click the Visible field to change the status to False.
      5. Move the Scroll Expand Switch button back to the original location.
      6. Close the GL_Transaction_Entry window, and then click OK in the Form Definition window.
      7. Click File, and then click Microsoft Dynamics GP or Microsoft Great Plains.
    • If the Transaction Entry window is not modified, follow these steps:
      1. Click Delete. When you are prompted to continue, click Yes.
      2. Click File, and then click Microsoft Dynamics GP or Microsoft Great Plains.

↑ Back to the top


References

For more information about the error message that this article describes, click the following article number to view the article in the Microsoft Knowledge Base:

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

For more information about the techniques that this article describes, see the following training materials:

↑ Back to the top


Keywords: kbnosurvey, kberrmsg, kbmbsvba, kbexpertiseadvanced, kbmbspartner, kbmbsmigrate, kbhowto, kb

↑ Back to the top

Article Info
Article ID : 951230
Revision : 1
Created on : 3/13/2017
Published on : 1/5/2015
Exists online : False
Views : 234