I wanted to fill a PopupMenu with a Table Field Names. I searched in the LR (both local and @ docs), but was not happy with the result: something easier must exists (I was thinking).
It tooks me time (one hour) to find the following:
[code] Dim Record_RS As RecordSet
Dim colName As String
// Get a RecordSet with the Fields definitions for a TABLE (called List_Data)
Record_RS = Data_Base_DB.FieldSchema(“List_Data”)
// How many Fields in a Record ?
Field_Cnt = Record_RS.RecordCount - 1 // 0-based value
Dim Foo as Variant // Foo = Record_RS.IdxField(3).BooleanValue // * Foo = Record_RS.Field("isPrimary").BooleanValue // * If Foo Then // Was something else at start, but I was unsuccessfull, so I used a Variant :( // Do not add the Unique ID (Primary Key) name into the PopupMenu Else // Fills the PopupMenu End If[/code]
- Surprise: Both lines gives me the same result: the Primary ID Field name is excluded from the list of available Columns names.
This coding design was not built in my brain, but at last I found it.
If you want to do the same, clears the Variant part (Foo) and use directly the relevant code:
If Record_RS.IdxField(3).BooleanValue Then
If Record_RS.Field("isPrimary").BooleanValue Then
The code in b. is my prefered (more explicit at reading time).
PS: The PopupMenu is part of a
Search <String> in Column <ColumnName> feature.