CasewareDocs

RenField

Renames an IDEA field and returns the actual new name of the renamed field (as a string).

Compatibility

Available as of IDEA version 10.0

Syntax

RenField(database as Object, oldFieldName as String, newFieldName as String, Optional description as String)

Parameters

database

Object containing the currently open database.

oldFieldName

Name of the field that needs to be renamed.

newFieldName

New name of the field.

description

Only one optional argument: Description.

Remarks

Error is raised if:

  • database is null
  • oldFieldName or newFieldName is null or empty.

Return value

Returns the actual new name of the renamed field.

Example

Dim SimpleCommands As Object 
Dim db As Object
Dim fileName As String
Dim newFieldName As String

Sub Main
Set SimpleCommands = SmartContext.MacroCommands.SimpleCommands

'Get the name of the database.
fileName = SmartContext.PrimaryInputFile

'Open the database.
Set db = Client.OpenDatabase(fileName)

'Change the name of the field "NAME" to "NEWNAME".
Set newFieldName = SimpleCommands.RenField db, "NAME", "NEWNAME", "My new field description"

'Close the database.
db.Close
Set db = Nothing

'Release object.
Set SimpleCommands = Nothing
End Sub
RenField | Caseware Docs