Private Sub AddressBlockAdd()

    Dim oRec As CRecord
    Set oRec = New CRecord

    oRec.Init REApplication.SessionContext
    oRec.Load 751

    Dim oAdd As CConstitAddress
    Dim oAdds As CConstitAddresses
    Set oAdds = oRec.Addresses
   
    Dim oPhone As CConstitAddressPhone
    Dim oPhones As CConstitAddressPhones

    Dim iCount As Integer

    For Each oAdd In oAdds
        If oAdd.Fields(CONSTIT_ADDRESS_fld_PREFERRED) = -1 Then
            Set oPhones = oAdd.Phones
        Else: End If
    Next oAdd
   
    Set oAdd = oAdds.Add
    With oAdd
        .Fields(CONSTIT_ADDRESS_fld_ADDRESS_BLOCK) = "123 Left Lane"
        .Fields(CONSTIT_ADDRESS_fld_CITY) = "Charleston"
        .Fields(CONSTIT_ADDRESS_fld_STATE) = "SC"
        .Fields(CONSTIT_ADDRESS_fld_POST_CODE) = "29464"
        For Each oPhone In oPhones
            With .Phones.Add
                .Fields(CONSTIT_ADDRESS_PHONES_fld_PHONETYPE) = oPhone.Fields(CONSTIT_ADDRESS_PHONES_fld_PHONETYPE)
                .Fields(CONSTIT_ADDRESS_PHONES_fld_NUM) = oPhone.Fields(CONSTIT_ADDRESS_PHONES_fld_NUM)
            End With
        Next oPhone
    End With

    Set oPhones = Nothing
   
    oRec.Save

    Set oAdds = Nothing
    oRec.Closedown
    Set oRec = 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. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.