Cols Class

Zero based array of columns in the recordset.  Read only in some cases Read/Write in other cases. Available only at run time.


Syntax

object.Cols.Count [= number ]
object.Cols(Index).Property  [= value ]

The syntax of the Cols Class has these parts:

PartDescription
objectA DGrid control.
number  Returns the number of columns in the grid. Data Type-Long

PropertyDescription
objectA DGrid control.
indexThe column number (zero based ). Range 0 through Cols.Count -1.
ColText Returns/Sets the column text displayed in the column headings of the grid. Default is the actual column name. Data Type-String
NumFormat Returns/Sets a Format String for Number and Date fields. Default is an empty string. Data Type-String (example "mm/dd/yyyy" or "$#,###.00")
ColWidthReturns/Sets the width in pixels of the specified column. Default is 100. Data Type-Long
AllowEditReturns/Sets whether or not the specified column can be edited. Default is True. Data Type-Boolean
NewValueReturns/Sets the value of the specified column when a new record is added. Default is a empty string. Data Type-Variant (the value will be what a user has entered when the BeforeAddNew event is fired)
ColAlignReturns/Sets the horizontal alignment of the specifed column. Default is set by field data type. Data Type-dgAlignConstants (0=dgLeft, 1=dgRight, 2= dgCenter)
DefaultValueReturns/Sets the default value for the specified field. This value is displayed in the New Record row of the grid. Default is the actual default value in DAO and Access databases, and empty string in ADO. Data Type-Variant
NumOnly Returns/Sets if only numbers can be entered in the edit control. Defaults to column data type. Data Type-Boolean
AutoNumber Returns True if an Access AutoNumber field. Only DAO and Access databases. Ignorned in ADO. Data Type-Boolean
AllowZeroLength Returns True if the field will accept a zero length string.  Data Type-Boolean
DataUpdatable Returns True if the field can be updated.  Data Type-Boolean
FieldSize Returns the number of bytes in a Memo or Binary fiels.  Data Type-Long (See your DAO and ADO documentation)
ColName Returns the actual field name of the underlying recordset.  Data Type-String
ColType Returns the DAO or ADO data type of the field in the underlying recordset.  Data Type-DataTypeEnumeration (See your DAO and ADO documentation)
ColSize Returns the number of bytes the field will accept. For String values this is the maximum number of characters. For Numeric values this is the size of the variable. Data Type-Integer
Required Returns True if the field requires an entry.  Data Type-Boolean
Locked Returns True if the field is a data type that DGrid is not capable of editing. Use the EditDblClick event and your own routines to edit Memo and Binary fields.  Data Type-Boolean

Remarks

See your ADO and DAO documentation for Data Type and Field Size values and descriptions.