Campaign lockouts

The two methods used to control access to editing a campaign are LockEdit and UnLockEdit. Anytime changes are being made to a campaign that is already on the Campaign Manager server, the code should be encapsulated within these two functions. The LockEdit function will fail if called by a campaign edit object that is already locked by another user.

Private Sub ChangeCampaign_Click(ByRef objCampaignEdit As IDVBCampaignEdit4)
    'Lockout the campaign and enter setup mode for editing
    objCampaignEdit.LockEdit
    objCampaignEdit.EnterSetupMode
    ' Make changes to campaign
    Call EditCampaignProperties(objCampaignEdit)
    ' Complete setup mode and unlock campaign
    objCampaignEdit.SetupComplete
    objCampaignEdit.UnLockEdit
End Sub

Locking a campaign edit object only affects the campaign edit object. A batch edit object is derived from a campaign edit object. Therefore, when the campaign edit object is locked a batch edit object cannot be retrieved for editing purposes. However, if a batch edit object was retrieved prior to locking the campaign edit object, then any changes can be made to that batch edit object. Subsequently, unlocking a campaign edit object only affects the campaign edit object. If individual batch edit objects are locked for edit in the campaign, unlocking the campaign does not unlock the batches.