Categorized | Featured

avatar

Using Modifier for VBA to Sort the Vendor Lookup by Name

Since most users look up vendors by vendor name, you can make the Dynamics GP’s Vendor Lookup window sort by the vendor’s name when the window opens using the Modifier with VBA tool. This tool may be active based on your current registration keys; if you don’t have access to the tool, you can purchase the license through your Dynamics GP partner.

To sort the Vendor Lookup window by the vendor’s name, follow these steps.

1.)    Navigate to Cards | Purchasing | Vendor to open the Vendor Maintenance window.

2.)    When you click the Vendor ID Lookup button, the Vendor Lookup window opens. Click Tools | Customize | Add Current Window to Visual Basic. This will add the Smartlist Vendor Lookup window to the Visual Basic project.

3.)    The next step is to click Tools | Customize | Add Fields to Visual Basic. This mouse pointer will change modes to let you know that you are in the Add Fields mode.

4.)    Next, click the Vendor Name column above the scrolling window to add the Vendor Name sort-by button to the Visual Basic project.

5.)    At this point, we have added the window and field we need to work with to the Visual Basic project. The next step is to click Tools | Customize | Visual Basic Editor, which opens the Visual Basic project window.

6.)    Open the Smarlist folder, then click Window and the After Activate event from the drop-down lists. The AfterActivate event occurs when a window is activated. A window is activated when it’s moved from the background to the foreground in an application. This will ensure the VBA code will execute after the window is activated, sorting by the vendor’s name. You’ll need to insert the VendorName.Value = 2 code to sort the lookup window’s contents by vendor name.

To test the VBA code, open the Vendor Lookup window. The vendors should now automatically be sorted by vendor name.

You’ll notice in the window above that there is a period after the Vendor Name window. This tells you there’s a VBA code active on this particular window. The VBA code is stored in a file with the .vba extension in the Dynamics GP client’s folder. This code only works on this particular workstation and will need to be installed on users’ workstations.

You can install it on other workstations by creating a package file through the Customizations Maintenance window and importing it to each workstation. Click Tools | Customize | Customization Maintenance to open the Customizations Maintenance window.

For more information on how to customize Dynamics GP, contact BKD’s Microsoft Dynamics GP support center at GPsupport@bkd.com.

This post was written by:

Steve is the leader of custom application development efforts for the BKD Technologies Microsoft Dynamics GP product team. He has more than 21 years of experience as an IT system administrator for Microsoft Windows, UNIX and Novell environments, including development and implementation of turnkey systems and custom applications. Steve is a Certified NetWare Administrator, Certified NetWare Engineer, Certified Software Engineer – Dexterity, Certified Integration Developer – Dexterity and Microsoft Great Plains Modifier with Visual Basic for Applications.

Leave a Reply


Dynamics GP Categories