Microsoft® ActiveX® replication controls provide detailed information about method failures. Each control has an ErrorRecords property that references a SQLReplErrors collection. To retrieve error information, you can enumerate through each SQLReplError object in the collection.
This example demonstrates how a Microsoft Visual Basic® program can configure the SQL Distribution control to synchronize data and to report detailed error information:
'Initialize the SQL Distribution control.
Dim oSQLDistribution As New SQLDistribution
Dim oErrorObject As New SQLReplError
On Error Goto Failure
'Configure the control for an OLE DB subscription
'<Set properties here>
'Synchronize the data
oSQLDistribution.Initialize
oSQLDistribution.Run
oSQLDistribution.Terminate
Failure:
‘Display error details
For Each oErrorObject in oSQLDistribution.ErrorRecords
MsgBox oErrorObject.Description, vbOKOnly, "Microsoft SQL Server Replication ActiveX Error " + CStr(oErrorOjbect.ErrorNumber)
Next