Share via


BeforeOverwrite Event

Occurs when an existing file is about to be overwritten.

Private Sub Object_BeforeOverwrite(ByVal DSCEventInfo As DSCEventInfo)

Object    A DataSourceControl object.

DSCEventInfo    The DSCEventInfo object that contains information about the event.

Remarks

This event may occur when you use the ExportXML method to export the current recordset. Set the ReturnValue property of the DSCEventInfo object to False to prevent the existing file from being overwritten. Set the DisplayAlert property of the DSCEventInfo object to dscDataAlertContinue to overwrite the file without prompting the user.

Note: Files that were not created by the Data Source Control will not be overwritten.

Example

This example allows a file created by the ExportXML method to be overwritten without prompting the user.

Sub MSODSC_BeforeOverwrite(DSCEventInfo)

   Dim dscConstants
   Set dscConstants = MSODSC.Constants

   'Don't alert the user when overwriting an existing file.
   DSCEventInfo.DisplayAlert = dscConstants.dscDataAlertContinue

End Sub

Applies to | DataSourceControl Object

See Also | DisplayAlert Property | DSCEventInfo Object | ExportXML Method | ReturnValue Property