NaomiP 7/20/2007 3:29:00 PM

Sample code for using RetrieveGlobals9 in Dynamics

Here is a short piece of code that demonstrates how to code for RetrieveGlobals9.dll in Dynamics GP

 Private Sub NextCust_Changed()

    If Me.CustomerID.Value > "" Then
        MsgBox "The Customer Number Field must be empty"
        Exit Sub
    End If
   
    Dim cmd
    Dim rst
    Set userinfo = CreateObject("RetrieveGlobals9.retrieveuserinfo")
    Set conn = userinfo.Connection
   
    'Create an ADO command object.
    Set cmd = CreateObject("ADODB.Command")
   
    'set the database to the currently logged in db.
    conn.DefaultDatabase = userinfo.intercompany_id()

    cmd.ActiveConnection = conn
    cmd.CommandType = 4 'adCmdStoredProc
   
    'Get the next cust number
    cmd.CommandText = "_4P_SOPgetNextCustomerNumber"
    Set rst = cmd.Execute
    If Not rst.EOF Then
        Me.CustomerID.Value = rst("vchrCustomerNumber")
    End If
   
    'Close the connection.
    If conn.State = 1 Then
       conn.Close
    End If
   
    'Cleanup.
    Set cmd = Nothing
    Set cn = Nothing

End Sub

Version: Unknown or N/A
Section: Dynamics GP
This thread has been marked as 'Closed' and archived


Table Definition Quick Links
All Tables
SOP Tables
RM Tables
GL Tables
POP Tables
HR Tables
PM Tables
UPR Tables
IV Tables
Olympic Tables
3