Working with window fields in your VBA project

To use window fields with VBA, you’ll first need to add a window and its window fields to your project.

Adding window fields to your project

To add window fields, switch to Microsoft Dynamics GP and display the window. On the Tools menu, point to Customize, then choose Add Window To Visual Basic. This adds the active (topmost) window to your project. With the window displayed, point to Customize on the Tools menu and choose Add Field To Visual Basic. This will activate field selection mode, and a selection pointer will appear. The following illustration shows the selection pointer:

[spacer]

Using the mouse, click on each data entry field, push button or list field you’ll use in your project. Be sure to click on the field itself, and not the field’s prompt. When you’ve finished adding fields, point to Customize on the Tools menu, and choose Add Fields to Visual Basic to deactivate field selection mode.

Field selection mode also deactivates when you switch to the Visual Basic Editor.


Window fields you’ve added to a project won’t appear in the Visual Basic Project Explorer like a window, report or grid object. Instead, they will appear in the Visual Basic Code window for a window object.

At this point, you can write VBA code for the window field object using a window field event, or you can reference the window field from other VBA procedures in your project.

Removing window fields from your project

You cannot remove individual field objects from your project, only window objects. When you remove a window object from your project, VBA also removes the all window field objects associated with the window.

To remove a window object from your project, switch to Microsoft Dynamics GP and display the window you want to remove. On the Tools menu, point to Customize, then choose Remove Current Window From Visual Basic. VBA will remove the window and any window fields associated with it.


Documentation Feedback