Welcome to Forums Sign in | Join | Help | Forums
in Search





Make the world a better place.

Does anyone know how to locking down Constit ID using System Macro ?

Last post 09-17-2008 12:39 PM by Nigel Henriques. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 09-09-2008 1:50 PM

    Does anyone know how to locking down Constit ID using System Macro ?

    Hi .. I would like to "lock down" the Constit and Gift ID's assigned by RE and would like to know the best of of accomplishing this via a VBA system macro. Is there a way to "lock down" the field (view only) in the before_open event or alternately is there a way to access the "previous" values of these fields that can be used to overwrite the field on the before_save event. Thx nigel

  • 09-09-2008 7:22 PM In reply to

    • Stu Pattison
    • Not Ranked
    • User Since: 2007
    • Posts 2
    • Organization: WCPE 89.7 FM
    • Products:  The Raiser's Edge

    Re: Does anyone know how to locking down Constit ID using System Macro ?

     Nigel,

    I don't know how to make the field read only, but maybe this work to restore it when the record is saved:

    Dim an array at the VBA module level with two columns per row, and, say, 10 rows.

    In the Before_Open event for a Constituent record, find a blank row in the array, then set the cell in first column of the row to the import ID of the record and the second cell to the original Const ID. 

    Then, in the Before_Save event, find the row with the matching import ID, restore the Const ID from the second cell of the row, then blank that row in the array. 

    Using an array indexed by the Import ID instead of just a variable lets you have several constituent records open at one time

    Hope this helps!   Stu Pattison, WCPE-FM Radio.

     

  • 09-17-2008 12:39 PM In reply to

    Re: Does anyone know how to locking down Constit ID using System Macro ?

    Stu,

    The use of an array would work in the Before_Open event with matching on the Import ID in the Before_Save event. Blackbaud support supplied me with some code that allows you to load the currently stored record which can be accessed in the Before Save event routine. It works perfectly and we don't have to worry about global variables colliding or being overwritten. I have included the code below for others. Thx Nigel

        'oRecord              : record object being saved    'bCancel              : set to true to cancel the save operation     Dim oConstituent As CRecord    Dim oRORecord As CRecord    Dim oDO As IBBDataObject        On Error GoTo ErrHandler        Set oConstituent = oRecord        If Not oConstituent Is Nothing Then        'bCancel = < place your custom save criteria here >        Set oDO = oRORecord        If oDO.FieldIsDirty(ERECORDSFields.RECORDS_fld_CONSTITUENT_ID) Then            Set oRORecord = New CRecord            With oRORecord                .Init oSessionContext                .Load oRecord.Fields(ERECORDSFields.RECORDS_fld_ID), True                oConstituent.Fields(RECORDS_fld_CONSTITUENT_ID) = oRORecord.Fields(RECORDS_fld_CONSTITUENT_ID)                .Closedown            End If            Set oRORecord = Nothing        End If    End If        Set oConstituent = Nothing        On Error GoTo 0        Exit Sub

     

Page 1 of 1 (3 items)