This article has been archived. It is offered "as is" and will no longer be updated.
This article describes how to use Modifier with Visual Basic for Applications (VBA) to make a company ID default based on the User ID that is using VBA.
Modify the company login window to default a specific company when a specific user ID is selected.
1. Add the company login window to VBA. a. Start Great Plains. When the company login window is open, press CTRL+F11 to add the window to the VBA editor. b. Press SHIFT+F11 to add the User ID and the Company ID fields to VBA: User ID, and the Company ID. c. Press SHIFT+F11 to stop adding fields to the VBA editor.
2. Start the VBA editor, and then add the following code to the window:
Private Sub Window_AfterOpen()If UserID = "LESSONUSER1" ThenCompany.Value = 1ElseIf UserID = "LESSONUSER2" ThenCompany.Value = 2End IfEnd Sub
The Company.Value=1 is the first company in the drop-down list, and Company.Value=2 is the second company in the drop-down list. Replace the LESSONUSER1 and LESSONUSER2 values with your actual user login IDs.
Note The Company.Value field will change if you create new companies. The companies are listed in the login window in alphabetic order. If you add any new companies, you must change the Company.Value number to reflect the change in the drop-down list order.