Sign Up Now!Log In
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
    End If
    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