Microsoft Office Tutorials and References
In Depth Information
Creating Task Items Automatically in Outlook
MsgBox Err.Number & "-" & Err.Description, _¶
vbOKOnly + vbExclamation, "Error"¶
Resume ExitSub¶
End Sub¶
' * * * * *¶
Private Sub Form_AfterDelConfirm(Status As Integer)¶
'Status tells if record has been deleted or not¶
If Status = acDeleteOK Then¶
'If record is deleted then validate if there is a¶
'saved EntryID to delete the related Task Item¶
'in DelTaskID variable¶
If Not Trim(DelTaskID) = "" Then¶
'Start Task Item Removal procedure¶
Call RemoveOLTask(DelTaskID)¶
End If¶
End If¶
End Sub¶
' * * * * *¶
Private Sub Form_BeforeUpdate(Cancel As Integer)¶
'Before updating a record¶
'Create or Edit a Task Item for this record¶
Call AddOLTask¶
End Sub¶
' * * * * *¶
Private Sub Form_Delete(Cancel As Integer)¶
'If record is being deleted¶
'then this event procedure is the last chance to¶
'save necessary OLTaskItemID value into a form variable¶
'for using Task Item Removal procedure after deletion¶
If IsNull(Me!OLTaskItemID.Value) Then¶
'There is no OLTaskItemID has been saved for this record¶
'Clean the DelTaskID value¶
DelTaskID = ""¶
'Save deleted record's OLTaskItemID value¶
DelTaskID = Me!OLTaskItemID.Value¶
End If¶
End Sub¶
The code for this macro goes into the module for the Orders form. In the Project
window (top left) of the VBE, right-click on the name ‘Form_Orders’ and select
the View Code option from the pop up menu. The example file already has the
code in the form.
View the Appendix to learn how to Navigate the Visual
Basic Editor.
Search JabSto ::

Custom Search