ComponentOne True DataControl 8.0
Error Event

 

Error Event

Occurs as a result of an error that takes place when no user code is being executed.

Syntax

TData_Error (ByVal ErrorNumber As Long, Description As String, ByVal Scode As Long, ByVal FieldName As String, ByVal Source As String, ByVal HelpFile As String, ByVal HelpContext As Long, fCancelDisplay As Boolean)

Remarks

Arguments: ErrorNumber is the error code, an integer that identifies the error that occurred.

Description is a string describing the error.

Scode is the status code of the error (usually can be ignored).

FieldName contains the name of the affected field, if the error occurred while trying to modify a field value,

Source is a string identifying the source of the error. It is either “TData”, meaning that the error is TData-specific (see below), or a string identifying an OLE DB provider.

HelpFile is a string containing the fully qualified path to the help file in which help on this error can be found. This argument can be left empty by the provider, meaning there is no help file.

HelpContext is a Long integer, the context ID identifying a topic within helpfile that provides help for the error. This argument can be set to 0 by the provider, meaning there is no help for this error.

fCancelDisplay is a variable that you can set to True (it is set to False initially) to suppress the standard TData error message box.

The Error event is similar to its counterpart in the standard ADO data control (Microsoft ADODC). That is, it occurs as the result of an error that takes place when the TData control is responding to user interaction, but no Visual Basic code is being executed.

Even if your application handles run-time errors in code, errors can still occur when none of your code is executing, such as when the user changes the current record by interacting with a bound control. If a data access error results from such an action, the Error event is fired.

If you set the fCancelDisplay argument to True, the standard True DataControl error message will not be displayed.

If the fCancelDisplay argument retains its default value of False, or you do not code a handler for this event, the standard message associated with the error will be displayed.

Error Codes: The following error codes are specific to True DataControl. For each such error, the ErrorNumber argument contains the error code, the Source argument contains “TData” string, and the Description argument contains an error description.

 

2000

Field constraint violation. FieldName indicates the affected field.

2001

Record constraint violation.

2002

Required field is left empty. FieldName indicates the affected field.

2003

Data type conversion error: data entered by the user in a bound control is invalid with respect to the field’s data type. FieldName indicates the affected field.

2005

Field is read-only. An attempt has been made to change the value of a read-only field. FieldName indicates the affected field.

2006

Data type conversion error: the new value assigned to a field programmatically is invalid with respect to the field’s data type. FieldName indicates the affected field.

2008

An attempt has been made to change TData collections in an event other than WillOpenData.

2009

An attempt has been made to set SourceRecordset or Array in an event other than OpenData.

2010

Creation of SourceRecordset failed, due to incorrect data source property settings or an error while creating the recordset by the OLE DB provider.

2011

An attempt to set QueryMode = True while DataMode is not 0 - DataSource.

2012

An invalid bookmark is set to the RowBuffer object in the UserReadData event procedure. All bookmarks returned by the programmer in DataMode = 2 – UserEvents should have the same variant data type.

2013

RetrieveFields method has been called with DataMode other than 0 - DataSource.

2014

This action is not allowed in TData event procedures.

2015

An attempt has been made to set SourceConnection in an event other than OpenData.

2016

An attempt has been made to set the SourceConnection property when SourceRecordset has already been set or created by TData.

 

Other error codes can occur in data source mode (DataMode = 0 – Data Source). They are data access errors that originate in the underlying SourceRecordset, reported by the OLE DB provider that supports your data connection. You can identify the provider by the value of the Source argument passed to the event procedure.

See Also

TData Control

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback