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.
Prevent User Logging In To Multiple Companies.zip
Comments
Anonymous
August 24, 2008
PingBack from http://blogs.msdn.com/developingfordynamicsgp/archive/2008/08/25/hiding-the-fabrikam-sample-company-date-dialog.aspxAnonymous
August 27, 2008
Posting from DynamicAccounting.net http://msdynamicsgp.blogspot.com/2008/08/use-vba-to-stop-multiple-logins-by.htmlAnonymous
January 09, 2011
Hello, I have implemented this solution but somehow it is not working. I still can log into all companies at same time using same user id.Anonymous
January 10, 2011
Hi Subrata I suggest using a breakpoint to trace the code and see what is happening. Try executing the SQL statements via SQL Enterprise manager and confirm what the results are. DavidAnonymous
June 24, 2016
Will this work in GP 2015?Anonymous
June 24, 2016
Hi RayThe v10.0 code probably will work.David