Public Sub NewSeat()
    Dim oEventSeats As cEventSeating2
    Dim oSection As cEventSection
    Dim oTable  As cSectionTable
    Dim oSeats As cTableSeats
    Dim oSeat   As cTableSeat
    
    Set oEventSeats = New cEventSeating2
    oEventSeats.Init REApplication.SessionContext
    oEventSeats.LoadByEventID lEventID
    For Each oSection In oEventSeats.Sections
        If CLng(oSection.Fields(EVENTSECTION_fld_ID)) = lSectionID Then
            For Each oTable In oSection.Tables
                If CLng(oTable.Fields(EVENTSECTIONTABLE_fld_ID)) = lTableID Then
                    Set oSeats = oTable.Seats
                    Set oSeat = oSeats.Add
                    With oSeat
                        .Fields(EVENTTABLESEAT_fld_SeatNumber) = oSeats.Count
                        .Fields(EVENTTABLESEAT_fld_SeatName) = "Seat " & oSeats.Count
                    End With
                    Exit For
                End If
            Next
            Exit For
        End If
    Next
    oEventSeats.Save
    oEventSeats.CloseDown
    Set oEventSeats = Nothing
End Sub

Public Sub NewSection()
    Dim lIndex1  As Long
    Dim lIndex2  As Long
    Dim lSeats  As Long
    Dim lTables  As Long
    Dim oEventSeats As cEventSeating2
    Dim oSections   As cEventSections
    Dim oSection    As cEventSection
    Dim oTables     As cSectionTables
    Dim oTable      As cSectionTable
    Dim oSeats      As cTableSeats
    Dim oSeat       As cTableSeat
    
    lTables = InputBox("How many Tables to add?", oSection.Fields(EVENTSECTION_fld_SectionName), 10)
    lSeats = InputBox("How many Seats to add to each table?", oSection.Fields(EVENTSECTION_fld_SectionName), 10)

    Set oEventSeats = New cEventSeating2
    oEventSeats.Init REApplication.SessionContext
    oEventSeats.LoadByEventID lEventID
    Set oSections = oEventSeats.Sections
    Set oSection = oSections.Add
    With oSection
        .Fields(EVENTSECTION_fld_SectionNumber) = oSections.Count
        .Fields(EVENTSECTION_fld_SectionName) = "Section " & oSections.Count
    End With
    '
    Set oTables = oSection.Tables
    For lIndex1 = 1 To lTables
            Set oTable = oTables.Add
            With oTable
                .Fields(EVENTSECTIONTABLE_fld_TableNumber) = oTables.Count
                .Fields(EVENTSECTIONTABLE_fld_TableName) = "Table " & oTables.Count
            End With
            Set oSeats = oTable.Seats
            For lIndex2 = 1 To lSeats
                Set oSeat = oSeats.Add
                With oSeat
                    .Fields(EVENTTABLESEAT_fld_SeatNumber) = oSeats.Count
                    .Fields(EVENTTABLESEAT_fld_SeatName) = "Seat " & oSeats.Count
                End With
                oEventSeats.Save
            Next
    Next
    oEventSeats.Save
    oEventSeats.CloseDown
    Set oEventSeats = Nothing
End Sub

Public Sub NewTable()
    Dim lIndex  As Long
    Dim lSeats  As Long
    Dim oEventSeats As cEventSeating2
    Dim oSection    As cEventSection
    Dim oTables     As cSectionTables
    Dim oTable      As cSectionTable
    Dim oSeats      As cTableSeats
    Dim oSeat       As cTableSeat
    
    lSeats = InputBox("How many Seats to add?", oSection.Fields(EVENTSECTION_fld_SectionName), 10)

    Set oEventSeats = New cEventSeating2
    oEventSeats.Init REApplication.SessionContext
    oEventSeats.LoadByEventID lEventID
    For Each oSection In oEventSeats.Sections
        If CLng(oSection.Fields(EVENTSECTION_fld_ID)) = lSectionID Then
            Set oTables = oSection.Tables
            Set oTable = oTables.Add
            With oTable
                .Fields(EVENTSECTIONTABLE_fld_TableNumber) = oTables.Count
                .Fields(EVENTSECTIONTABLE_fld_TableName) = "Table " & oTables.Count
            End With
            For lIndex = 1 To lSeats
                Set oSeats = oTable.Seats
                Set oSeat = oSeats.Add
                With oSeat
                    .Fields(EVENTTABLESEAT_fld_SeatNumber) = oSeats.Count
                    .Fields(EVENTTABLESEAT_fld_SeatName) = "Seat " & oSeats.Count
                End With
            Next
            Exit For
        End If
    Next
    oEventSeats.Save
    oEventSeats.CloseDown
    Set oEventSeats = Nothing
End Sub


Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.