'This procedure will be called before a record of the specified type is saved
Public Sub Constituent_BeforeSave(oRecord As Object, bCancel As Boolean)
    'oRecord              : record object being saved
    'bCancel              : set to true to cancel the save operation

    Dim oConstituent As CRecord
    On Error GoTo ErrHandler
    Set oConstituent = oRecord
    If Not oConstituent Is Nothing Then
        Dim oOriginal As CRecord
        Set oOriginal = New CRecord
        oOriginal.Init REApplication.SessionContext
        'Load a copy of the record from the database
        'This copy will contain the record's original unmodified fields
        oOriginal.Load oConstituent.Fields(RECORDS_fld_ID), True
        Dim oNewProspect As CProspect
        Dim oOldProspect As CProspect
        Set oNewProspect = oConstituent.Prospect
        Set oOldProspect = oOriginal.Prospect
        If REApplication.SessionContext.CurrentUserID <> 1 Then
            If oNewProspect.Fields(PROSPECT_fld_CLASSIFICATION) <> oOldProspect.Fields(PROSPECT_fld_CLASSIFICATION) Or _
                oNewProspect.Fields(PROSPECT_fld_STATUS) <> oOldProspect.Fields(PROSPECT_fld_STATUS) Then
                MsgBox "You do not have permission to modify Prospect fields"
                bCancel = True
            End If
        End If
    End If
    Set oConstituent = Nothing
    On Error GoTo 0
    Exit Sub
    Dim sErr As String
    sErr = Err.Description
    On Error GoTo 0
    '< place your custom error handling code here >
    MsgBox "Error processing Constituent_BeforeSave : " & sErr
    Set oConstituent = Nothing
    bCancel = False
    Exit Sub

End Sub

Blackbaud provides 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 that you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures.  Blackbaud Customer Support can help explain the functionality of a particular procedure but they will not modify, or assist you with modifying, these examples to provide additional functionality.  If you are interested in learning more about VBA and API modules, contact our Sales department at solutions@blackbaud.com.