FIX: Attempting to Refresh Null TableDef Field Causes GP Fault
ID: Q94773
|
The information in this article applies to:
-
Microsoft Visual Basic programming system for Windows, version 2.0
SYMPTOMS
A general protection (GP) fault occurs when you attempt to refresh a Null
Fields collection of a TableDef. Instead, you should receive this error:
"Method not applicable to this object."
When the Fields collection for a TableDef is not Null, the Refresh method
works as expected.
STATUS
Microsoft has confirmed this to be a problem in Microsoft Visual Basic
version 2.0 for Windows. This problem was corrected in Microsoft Visual
Basic version 3.0 for Windows.
MORE INFORMATION
The following steps reproduce the problem:
- Start the Professional Edition of VB.EXE with ODBC support already
installed.
- Add the following code to the Form_Click event procedure of Form1:
Form_Click ()
Dim db As Database
Dim tDef As TableDef
DBName$ = "Server1"
Set db = OpenDatabase(DBName$) '* DBName$ name of Database
'* that is already setup on
'* the SQL Server. This
'* DBName$ should be set to
'* server name that listed in
'* the ODBC.INI file.
Set tDef = db.TableDefs(0)
Set db = OpenDatabase(DBName$)
tDef.Fields.Refresh '* This should result in a
'* error, but instead results
'* in a GP Fault.
End Sub
In order to reproduce the problem, the first TableDef in the database,
TableDefs(0), cannot have any fields associated with it.
- Press the F5 key or ALT+R+S.
At this point, a GP fault occurs -- usually at address 0008:0083 in
VBODBCA.DLL.
To avoid the problem, make sure the Fields collection is not Null before
using the Refresh method. To do this, replace the tDef.Fields.Refresh
statement in step 2 above with the following code:
If Not tDef.Fields = Null Then
tDef.Fields.Refresh
End If
Additional query words:
2.00 3.00 GPF buglist2.00 fixlist3.00
Keywords :
Version :
Platform :
Issue type :