FIX: Field Name Same as Reserved Word Can Cause GP Fault

Last reviewed: October 30, 1997
Article ID: Q113687
3.00 WINDOWS kbprg kbbuglist

The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, version 3.0

SYMPTOMS

It is possible to receive a general protection (GP) fault in VB.EXE at the address 0025:3182 when using the data access features of Visual Basic. You may also notice corruption in your source code if the source is saved in the binary format and reloaded. The problem may not occur all the time.

CAUSE

This problem stems from using field names that are reserved words in Visual Basic. The problem occurs when using the following syntax to reference the field:

   Recordset![Reserved]

where "Recordset" is a table, dynaset, snapshot, or data control recordset, and "Reserved" is any Visual Basic reserved word.

RESOLUTION

To avoid the problem use the Fields collection to refer to the field. For example:

   Recordset.Fields("Reserved").Value
   Recordset("Reserved")

where "Recordset" is a table, dynaset, snapshot, or data control recordset, and "Reserved" is any Visual Basic reserved word.

STATUS

Microsoft has confirmed this to be a bug in Visual Basic version 3.0 for Windows. This problem has been corrected in Visual Basic version 4.0.

Steps to Reproduce Problem

  1. Start a new project in Visual Basic. Form1 will be created by default.

  2. Add the following code to the Form Load event:

       Sub Form_Load()
          Dim tb As Table
          tb![To] = 12
       End Sub
    
    

  3. Run the program. You should get an error and the code will be changed to the following.

       Sub Form_Load()
          Dim tb As Table
          tb!To = 12
       End Sub
    


Additional reference words: buglist3.00 3.00 fixlist4.00 GPF
KBCategory: kbprg kbbuglist
KBSubcategory: APrgDataAcc
Keywords : APrgDataAcc kbbuglist kbprg
Version : 3.00
Platform : WINDOWS
Solution Type : kbfix


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.

Last reviewed: October 30, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.