ReturnValue Property

Microsoft Office Web Components Object Model

ReturnValue Property

       

Returns or sets the return value for the specified event. You can cancel the default action for some events by setting this property to False. Read/write Boolean.

expression.ReturnValue

expression   Required. An expression that returns a DSCEventInfo object.

Example

This example uses the BeforeInsert event to prevent the user from adding another record to the recordset once it reaches 75 records.

Sub MSODSC_BeforeInsert(DSCEventInfo)
   Dim rstCurrentData

   ' Set a variable to the recordset.
   Set rstCurrentData = DSCEventInfo.DataPage.Recordset

   ' Check to see if the recordset has reached its limit.
   If rstCurrentData.RecordCount >= 75 then

      ' Display a message to the user.
      MsgBox "Cannot add any more records."

      ' Cancel the insertion of the record.
      DSCEventInfo.ReturnValue = False
   End If
End Sub