Microsoft KB Archive/126223

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

Article ID: 126223

Article Last Modified on 1/9/2003

-

APPLIES TO


 * Microsoft Visual Basic 3.0 Professional Edition

-



This article was previously published under Q126223



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.



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 query words: 3.00

Keywords: kbprb KB126223

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.