All pastes #813269 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-12-12 12:12 UTC
rendered paste body
    Public Sub ConnectSage()
        Dim sSetupFile As String

        Dim oInvoiceRecord As Object

        ConfigOpt.Initialize(Asm.Location + ".config")

        sSetupFile = ConfigOpt.GetOption("SageDirectory") & "\SETUP.DTA"
        Dim oFile As System.IO.FileInfo
        oFile = New System.IO.FileInfo(sSetupFile)

        Select Case oFile.Length

            Case 10640
                oSDO = New SageDataObject120.SDOEngine
            Case 10745
                oSDO = New SageDataObject130.SDOEngine
            Case 11076
                oSDO = New SageDataObject140.SDOEngine
            Case Else
                MsgBox("Sage Version incorrect.  This program only supports V12, 2007 and 2008")
                Mainform.Close()
        End Select

        oWS = oSDO.Workspaces.Add("Example")
        szDataPath = ConfigOpt.GetOption("SageDirectory")

        oInvoiceRecord = oWS.CreateObject("InvoiceRecord")
        oInvoiceRecord.Fields.Item("INVOICE_NUMBER").Value = InvoiceRef


    End Sub