Q129799: BUG: Data Control Errors Do Not Populate Error Object
Article: Q129799
Product(s): Microsoft Visual Basic for Windows
Version(s): 4.00
Operating System(s):
Keyword(s): kbbuglist
Last Modified: 11-JAN-2001
-------------------------------------------------------------------------------
The information in this article applies to:
- Microsoft Visual Basic Standard Edition, 32-bit, for Windows, version 4.0
- Microsoft Visual Basic Professional Edition, 16-bit, for Windows, version 4.0
- Microsoft Visual Basic Professional Edition, 32-bit, for Windows, version 4.0
- Microsoft Visual Basic Enterprise Edition, 16-bit, for Windows, version 4.0
- Microsoft Visual Basic Enterprise Edition, 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
--------------------------
1. Start a new project in Visual Basic. Form1 is created by default.
2. Add a data control (Data1) and a check box (Check1) to Form1.
3. Set the following properties for the controls:
Control Property Value
-----------------------------------
Data1 Databasename Biblio.MDB
Data1 RecordSource Authors
Check1 DataSource Data1
Check1 DataField Author
4. 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
5. 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 : kbbuglist
Technology : kbVBSearch kbAudDeveloper kbVB400Search kbVB400 kbVB16bitSearch
Version : 4.00
Issue type : kbbug
=============================================================================
THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.
Copyright Microsoft Corporation 1986-2002.