In Microsoft Dynamics GP 10.0, new connection objects were added to the VBA code. These new connection objects replace the RetrieveGlobals.dll and RetrieveGlobals9.dll files in Microsoft Dynamics GP. This new VBA code lets you create an active connection based off the username and password of the user who is currently logged into Microsoft Dynamics GP. This new connection object is named UserInfoGet. This UserInfoGet connection object enables you to use the following properties and methods:
The following is a sample of code of the new UserInfoGet connection object.
Dim cn As New ADODB.connection
Dim rst As New ADODB.recordset
Dim cmd As New ADODB.Command
Private Sub PushButtonM79_AfterUserChanged()
cmd.CommandText = "Select * from RM00101"
Set rst = cmd.Execute
MsgBox (rst!custnmbr)
End Sub
Private Sub Window_AfterOpen()
Set cn = UserInfoGet.CreateADOConnection
cn.DefaultDatabase = UserInfoGet.IntercompanyID
cmd.ActiveConnection = cn
End Sub
cmd.Parameters.Append cmd.CreateParameter("@vchrItemNumber", adVarChar, adParamInput, 31, [ItemNumber])
cmd.Parameters.Append cmd.CreateParameter("@vchrSiteID", adVarChar, adParamInput, 11, [SiteID])