PRB: GPF in MSAJT200.DLL Viewing SQL Prop. of Pass-Thru Query

Last reviewed: July 24, 1995
Article ID: Q119112
The information in this article applies to:
  • Professional Edition of Microsoft Visual Basic for Windows, version 3.0
  • Microsoft Access 2.0/Visual Basic 3.0 Compatibility Layer

SUMMARY

If you attempt to access the SQL property of a querydef object of an Microsoft Access version 2.0 pass-through query, you get a general protection fault (GPF) in module MSAJT200.DLL at 0080:239D. The other SQL- specific query types, Union and Data Definition, operate correctly.

STATUS

This behavior is by design. It is a limitation in the Professional Edition of Microsoft Visual Basic for Windows, version 3.0 and the Microsoft Access 2.0/Visual Basic 3.0 Compatibility Layer. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The Compatibility Layer was intended to make Visual Basic work with Microsoft Access version 2.0 format databases. It was not designed to expose all the new functionality in the database engine for Microsoft Access version 2.0. Therefore, the Compatibility Layer may permit access to certain new functionality (such as new SQL syntax and query types) with some limitations. It may also produce unforeseen errors when you use these new features.

The following code demonstrates the problem. First, create a pass-through query in Microsoft Access version 2.0:

  1. In the Database window, choose the Query button and then the New button.

  2. In the New Query window, select New Query. Microsoft Access displays an empty Query window in Design view and the Add Table dialog box.

  3. Without adding tables or queries, choose the Close button in the Add Table dialog box.

  4. From the Query menu, choose SQL Specific, and then choose Pass-Through. Microsoft Access displays the SQL Pass-Through Query window.

  5. Choose Properties from the View menu. In the query property sheet, type the ODBC Connect Str property to specify information on the database to which you want to connect. For example:

          ODBCConnectStr = "odbc;dsn=texas;uid=sa;pwd=;database=playpen"
    

  6. Type your pass-through query. For example:

          SELECT TempTbl.* FROM TempTbl
    

  7. In the query property sheet, set the ReturnsRecords property to Yes if the query will return records, or No if the query will not return records (for our test case, set it to Yes). To close the Properties dialog, double- click its system menu.

  8. To run the query, choose the Run button on the toolbar, or choose Run from the Query menu. (For a pass-through query that returns records, you can choose the Datasheet View button or choose Datasheet from the View menu.)

  9. Save the query as "PassThrough" and exit Microsoft Access.

Now, return to Visual Basic and perform the following operations to show the problem:

  1. Start an new project in Visual Basic; form1 is created by default.

  2. Place a command button (Command1) on the form, and add the following code to the Click() event:

          Sub Command1_Click ()
            Dim db As database
            Dim qd As querydef
    
            'open the database and querydef objects
            Set db = OpenDatabase("c:\access2\db1.mdb")
            Set qd = db.OpenQueryDef("PassThrough")
    
            MsgBox "A GP Fault will occur on the next line"
            'This line is where the GP Fault will occur
            Print qd.SQL
            MsgBox "If you see this, you chose Ignore or the GP Fault did not
          occur"
    
            'clean up
            qd.Close
            db.Close
          End Sub
    
    

  3. Save the project and run it. After you choose OK on the first message box, you get the GPF.


Additional reference words: 3.00 ssvc
KBCategory: kbprg kbcode kbprb
KBSubcategory: APrgDataAcc


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: July 24, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.