Color scheme: Dark
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library API reference » WklColumns

WklColumns

WklColumns class

Signature

Dim myWklColumns As WklColumns

Summary

The columns of a tree list.

Parameters

None

Remarks

Returned by WklTreeList.Columns. Supports For Each. The order of the collection is the order of creation; the display order is WklColumn.VisibleIndex within each band.

Not created directly; returned by other members of the library.

MemberKindSummary
`Item`PropertyReturns a column by position or name.
`Count`PropertyReturns the number of columns.
`Add`MethodAdds a column for a field.
`Remove`MethodRemoves a column.
`Clear`MethodRemoves all columns.

Code example

Dim c As WklColumn
For Each c In Me!List1.Object.Columns
    Debug.Print c.Name, c.Caption, c.Width
Next

Inheritance

None

Item property

Signature

Property Get Item(ByVal Index As Variant) As WklColumn

Summary

Returns a column by position or name.

Parameters

NameTypeOptionalDefaultDescription
IndexVariantNo–A 0-based position (Long) or a column name (String).

Property value: `WklColumn` – The column.

Remarks

Default member: it can be left out, as in myWklColumns(...) for myWklColumns.Item(...). Read-only.

Code example

None

Inheritance

Declared by WklColumns.

Count property

Signature

Property Get Count() As Long

Summary

Returns the number of columns.

Parameters

None

Property value: Long – The number of columns.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklColumns.

Add method

Signature

Function Add(ByVal FieldName As String, Optional ByVal Caption As String = "", Optional ByVal Band As String = "") As WklColumn

Summary

Adds a column for a field.

Parameters

NameTypeOptionalDefaultDescription
FieldNameStringNo–The field of the record source.
CaptionStringYes""The header text; empty for the field name.
BandStringYes""The name of the band that holds the column; empty for none.

Return value: `WklColumn` – The new column.

Remarks

The column's name is the field name. The first visible column holds the tree unless WklTreeList.TreeColumn names another one.

There is no method that adds a column for every field of the record source (the designer's “Spalten aus Feldern anlegen”). In VBA, add the columns from the fields of a recordset, as the example shows; the designer does the same and skips fields that already have a column.

Code example

Dim rs As DAO.Recordset, fld As DAO.Field
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tblCustomers WHERE False")
With Me.Grid1.Object.Columns
    .Clear
    For Each fld In rs.Fields
        .Add fld.Name, ""
    Next
End With
rs.Close

Inheritance

Declared by WklColumns.

Remove method

Signature

Sub Remove(ByVal Index As Variant)

Summary

Removes a column.

Parameters

NameTypeOptionalDefaultDescription
IndexVariantNo–A 0-based position or a column name.

Remarks

None

Code example

None

Inheritance

Declared by WklColumns.

Clear method

Signature

Sub Clear()

Summary

Removes all columns.

Parameters

None

Remarks

None

Code example

None

Inheritance

Declared by WklColumns.

en/wiki/msaccess/comctl/api-reference/wklcolumns.txt · Last modified: by Wolfgang van der Stille