FieldOptionStr

Method
Retrieves the option string of a field.

Category
Fields

 

Syntax
Function FieldOptionStr(ByVal hTable As Long, ByVal FieldNo As Long) As String

hTable
The handle to the table.

FieldNo
The option field whose option string is to be retrieved.

 

Example

'Case "FieldInfo"

'Lists the information about the fields in the customer-table

  tmpLong = CF1.NextField(hTable, 0)

  Do While tmpLong <> 0

  tmpBool = False

  tmpStr = Str$(CF1.FieldLen(hTable, tmpLong)) & ", "

  tmpVar = CF1.FieldName(hTable, tmpLong)

  If VarType(tmpVar) = vbString Then

  tmpStr = tmpStr & tmpVar & ", "

  tmpVar2 = CF1.FieldNo(hTable, tmpVar)

  If VarType(tmpVar2) = vbLong Then

  tmpStr = tmpStr & tmpVar2 & ", "

  tmpVar2 = CF1.FieldType(hTable, tmpLong)

  If VarType(tmpVar2) = vbInteger Then

  tmpStr = tmpStr & tmpVar2 & ", "

  tmpVar2 = CF1.FieldSize(hTable, tmpLong)

  If VarType(tmpVar2) = vbInteger Then

  tmpStr = tmpStr & tmpVar2 & ", "

  tmpVar2 = CF1.FieldClass(hTable, tmpLong)

  If VarType(tmpVar2) = vbInteger Then

  tmpStr = tmpStr & tmpVar2 & ", "

  tmpVar2 = CF1.FieldOptionStr(hTable, tmpLong)

  If VarType(tmpVar2) = vbString Then

  tmpStr = tmpStr & tmpVar2

  tmpLong = CF1.NextField(hTable, tmpLong)

  tmpBool = True

  End If

  End If

  End If

  End If

  End If

  End If

  If Not (tmpBool) Then

  Exit Do

  End If

  Loop

  If tmpBool Then

  tmpStr = "Fieldinfo from the last field: " & tmpStr

  logWr tmpStr

  Else

  logWr "Error in a return value"

  End If

 

  CF1.CloseTable hTable

 

Comments
FieldOptionStr returns a string containing the options for a specified option field. Only fields of type Option have an option string. The string consists of a comma-separated list of the valid options for the field that match the valid values of the option field.

If no field exists with the number specified in FieldNo or is not of the Option type, the function will raise an exception.

This function cannot be used to change the option string of the field, only to retrieve it. Option strings can only be modified in C/SIDE.

For more information about fields and option strings, see the Application Designer’s Guide.



© 2009 Microsoft Corporation. All rights reserved.