Skip to main content

Unprotect a column

Hi Brain,
I have extracted a single record to from source file to extracted File.
Then I need to edit the values in this column. Is it possible.
I tried to enable protect = False, but it's not working. I tried with the below code. could you please check this.
Dim db As Database
Dim table As Object
Dim newFieldObject As Object
Dim newFieldName As String
Dim newField As Object
 
Set db = Client.OpenDatabase(dbName)
    Set newField = db.TableManagement
    Set table = db.TableDef
    Set newFieldObject = table.newField
    Set newFieldName = "Colname"
    newFieldObject.Name = newFieldName
    newFieldObject.Protected = False
    newField.PerformTask

Brian Element Tue, 08/27/2019 - 14:29

Hi Jiyajijp,

A couple of things with this.  It doesn't work on a virtual field but only an IDEA field.  Also what you are doing above is creating a new field for a new database, if the field already exists you can do something like this:

Set db = Client.OpenDatabase(dbName)

Set table = db.TableDef

Set field = table.GetField("MY_FIELD")

field.Protected = True

this will unprotect a field for editing.  Once you are done then you can protect the field with:

field.Protected = True

Hope that makes sense.

Brian

The website encountered an unexpected error. Try again later.