Below is a snippet of sample code that edits the preferred address if the address block contains PO Box;

Private Sub RaisersEdgeRecord_BeforeOpen(oRecord As Object)

Dim ocons As CRecord

Set ocons = oRecord

Dim oadd As CConstitAddress

For Each oadd In ocons.Addresses

   If oadd.Fields(CONSTIT_ADDRESS_fld_PREFERRED) = "-1" Then

       If oadd.Fields(CONSTIT_ADDRESS_fld_ADDRESS_BLOCK) <> "PO Box" Then

           With oadd

           .Fields(CONSTIT_ADDRESS_fld_ADDRESS_BLOCK) = "PO Box 124"

           End With

       End If

   End If

Next oadd


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.