PRB: "Can't Perform Operation on a Nontable" w/ ISAM TableDef

Last reviewed: June 21, 1995
Article ID: Q126223
The information in this article applies to:

- Professional Edition of Microsoft Visual Basic for Windows,

  version 3.0

SYMPTOMS

If you try to add or remove a field in a TableDef object for an Installable ISAM database table (Btrieve, dBASE, FoxPro, or Paradox) that contains data, you receive error 3282:

   Can't perform operation on a nontable.

CAUSE

This error message occurs when the table contains data. The Visual Basic database engine can't modify the table structure of an ISAM table if that table has data in it.

WORKAROUND

Add a new tabledef with the structure you want. Then move the records from the old table into the new, and delete the old table.

STATUS

This behavior is by design.

MORE INFORMATION

Steps to Reproduce Behavior

Create and run a project that contains the following sample code. It generates the error message if MyTable contains data:

Sub Command1_Click ()
   Const DB_TEXT = 10
   Dim db As database
   Dim td As tabledef
   Dim fd As Field

   On Error Goto AppendTrap

   ' Open the database and set the tabledef
   Set db = OpenDatabase("c:\dBASE", False, False, "dBASE iii")
   Set td = db.TableDefs("MyTable")

   ' Create a new field object and append to the tabledef
   Set fd = New Field
   fd.Name = "f1"
   fd.Type = DB_TEXT
   fd.Size = 15         ' Creates a text field length 15 characters
   td.Fields.Append fd  ' Error occurs here!

   db.Close
   On Error Goto 0
   Exit Sub

AppendTrap:
   If Err = 3282 Then
      MsgBox "Cannot Modify Table - it contains data!"
      Resume Next
   Else
      MsgBox Error$
      On Error Goto 0
      Exit Sub
   End If
End Sub


Additional reference words: 3.00
KBCategory: kbprg kbprb
KBSubcategory: APrgDataIISAM


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