Private Sub cmdStart_Click()
    'This is just an example program to show how to acknowledge a UN/EDIFACT EDI file
    'in VB6 using the Framework EDI component

        Dim oEdiDoc As Fredi.ediDocument
        Dim oSegment As Fredi.ediDataSegment
        Dim oSchemas As Fredi.ediSchemas
        Dim oAck As Fredi.ediAcknowledgment
        Dim sSefFile As String
        Dim sEdiFile As String
        Dim sAckfile As String
        Dim sPath As String

        cmdStart.Enabled = False
        Me.MousePointer = vbHourglass
    
        sPath = App.Path & "\"
        sSefFile = "INVOIC_S93A.SEF"
        sEdiFile = "INVOIC.TXT"
        sAckfile = "Ack_CONTRL_" & sEdiFile
    
        'instantiate edi document
        Set oEdiDoc = New Fredi.ediDocument
    
        'Set cursor type to forward only to save RAM memory
        oEdiDoc.CursorType = Cursor_ForwardOnly
    
        'Stops FREDI from using the internal standard reference
        Set oSchemas = oEdiDoc.GetSchemas
        oSchemas.EnableStandardReference = False
    
        'Load all SEF files
        oEdiDoc.ImportSchema sPath & "CONTRL.SEF", Schema_Standard_Exchange_Format
        oEdiDoc.ImportSchema sPath & sSefFile, Schema_Standard_Exchange_Format
    
        'By default, FREDI uses the  universal coordinated time (UTC), however you can change it to local time
        oEdiDoc.Option(OptDocument_UseLocalTime) = 1

        'Enable acknowledgment
        Set oAck = oEdiDoc.GetAcknowledgment
        oAck.EnableFunctionalAcknowledgment = True
    
        'Set start of interchange control number
        oAck.Property(PropertyAck_StartInterchangeControlNum) = 100

        'Define terminators
        oEdiDoc.SegmentTerminator = "'" & vbCrLf
        oEdiDoc.ElementTerminator = "+"
        oEdiDoc.CompositeTerminator = ":"
        oEdiDoc.ReleaseIndicator = "?"
    
        'Load EDI file
        oEdiDoc.LoadEdi sPath & sEdiFile
    
        'Iterate thru all segments of EDI File
        Set oSegment = oEdiDoc.FirstDataSegment
        Do While Not oSegment Is Nothing
    
            Set oSegment = oSegment.Next
        Loop
    
        'oAck object can also be modified
    '    'modify acknowledgmet object
    '    Set oSegment = oAck.GetFirstContrlDataSegment
    '    'modify UNB segment
    '    Set oSegment = oSegment.GetDataSegmentByPos("UNB\UNB")
    '    oSegment.DataElementValue(4) = "050322"  ' Change date in UNB segment
    '    'modify UNH segment
    '    Set oSegment = oSegment.GetDataSegmentByPos("UNH\UNH")
    '    oSegment.DataElementValue(5, 1) = "12345"   'Change message subset id
    
        'Save the acknowledgment into a file
        oAck.Save sPath & sAckfile

        Me.MousePointer = vbNormal
    
        MsgBox "Done. Output file = " & sPath & sAckfile
        cmdStart.Enabled = True
    
    
    End Sub
    

    Click here to download a trial version of the Framework EDI