VBA - Preventing Users from logging into multiple companies Example
Microsoft Dynamics GP uses concurrent licensing which provides for a maximum number of users logged into the system at any one time. Each time a user logs into a company, one license is used.
On systems with more than one company, users may use multiple instances of the application running on their system to log into a number of companies at the same time. This might use up more licenses than expected and thus prevent other users from logging in.
This sample uses Visual Basic for Applications (VBA) and ADO (ActiveX Data Objects) to create a connection to SQL Server. Using this connection, the script will check the tables and confirm that the user is not already logged into another company and if they are it will stop the login from proceeding.
This code also includes a VBA based method of Hiding the Fabrikam sample company date dialog as well as the commented out code for the VBA - Preventing the User Login Activity window from opening Example.
NOTE: The method of opening an ADO connection to SQL Server differs for each version. v8.00 uses the external RetrieveGlobals.dll, v9.00 use the external RetrieveGlobals9.dll and v10.00 uses the built-in UserInfoGet object. v10.00 will need at least Service Pack 1 to use this sample.
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.