BUG: Data Control Errors Do Not Populate Error Object
ID: Q129799
|
The information in this article applies to:
-
Microsoft Visual Basic Standard, Professional, and Enterprise Editions, 16-bit and 32-bit, for Windows, version 4.0
SYMPTOMS
A "Type Mismatch" error is generated when a control is bound to a field
with an incompatible type, but the Error object is not populated when it is
examined in the Data Control Error event.
CAUSE
This is a limitation of the Data Control in Visual Basic version 4.0. When
the DAO generates an error, the Error object is cleared when the Error
event for the Data Control is fired.
RESOLUTION
For more information, search for the "Trappable Data Access Errors" in the
Help menu when building your error handling code.
You are not prevented in any way from writing the exact same error handling
code you would have written previously. Note that the error number passed
as a parameter to the Data Control's Error will be correct. Only the Error
object is affected. Also, most error checking in the DAO will be
unaffected. If a Field or Database object generates the error, then the
Error object is properly populated.
STATUS
Microsoft has confirmed this to be a problem in the Microsoft products
listed at the beginning of this article. We are researching this problem
and will post new information here in the Microsoft Knowledge Base as it
becomes available.
MORE INFORMATION
Steps to Reproduce Problem
- Start a new project in Visual Basic. Form1 is created by default.
- Add a data control (Data1) and a check box (Check1) to Form1.
- Set the following properties for the controls:
Control Property Value
-----------------------------------
Data1 Databasename Biblio.MDB
Data1 RecordSource Authors
Check1 DataSource Data1
Check1 DataField Author
- Add the following code to the Data1_Error procedure.
Private Sub Data1_Error(DataErr As Integer, Response As Integer)
Debug.Print "DataErr = "; DataErr
Debug.Print "Description = "; Err.Description
Debug.Print "HelpContext = "; Err.HelpContext
Debug.Print "HelpFile = "; Err.HelpFile
Debug.Print "Number = "; Err.Number
Debug.Print "Source = "; Err.Source
'Response = vbDataErrContinue
End Sub
- Start the program by clicking Start on the Run menu or by pressing the
F5 key.
The program immediately generates a "Type Mismatch" error and pops up a
dialog. The information in the Debug window looks like this:
DataErr = 13
Description =
HelpContext = 0
HelpFile =
Number = 0
Source =
If the Response = vbDataErrContinue is added to the program, the dialog
will not pop up, but the output will be the same.
Additional query words:
4.00 buglist4.00 vb4win vb4all
Keywords :
Version : 4.00
Platform : WINDOWS
Issue type :