PRB: "Can't Perform Operation on a Nontable" w/ ISAM TableDefLast reviewed: June 21, 1995Article ID: Q126223 |
|
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, version 3.0
SYMPTOMSIf 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. CAUSEThis 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.
WORKAROUNDAdd a new tabledef with the structure you want. Then move the records from the old table into the new, and delete the old table.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce BehaviorCreate 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
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |