CasewareDocs

FieldExists

Searches for a field inside an IDEA database.

Compatibility

Available as of IDEA version 9.0

Syntax

FieldExists(database as Object, fieldName as String)

Parameters

database

Object containing the opened database.

fieldName

Name of the field to be searched.

Return Value

True if field is found.

Remarks

Error is raised if

  • database is null
  • fieldName is empty

Example

Dim  SimpleCommands As Object 
Dim db As Object
Dim SourceName As String

Sub Main
Set SimpleCommands = SmartContext.MacroCommands.SimpleCommands

'Get name of source database.
SourceName = SmartContext.PrimaryInputFile

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

'Search for "AMOUNT" field in database SourceName.
If SimpleCommands.FieldExists(db, "AMOUNT") Then

'Do something with field AMOUNT.
End If

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

'Release object.
Set SimpleCommands = Nothing
End Sub