Can Header text be used for cbo.column() identity rather than #s?

  • Thread starter Thread starter WDSnews
  • Start date Start date
W

WDSnews

The addressing technique of the column object is generally presented as:

comboboxname.Column(#)

Where the number is used to identify a specific column, beginning with zero.
However, is it possible to identify the column with header text? such
as....

comboboxname.Column("ID")

In the case of a SQL statement such as SELECT [Item Types].ID AS ItemType
...... The associated column might be addressed as

comboboxname.Column("ItemType")

If it works, is there a reason not to prefer this? My goal is to allow
columns to be rearranged without having to repair code.
 
No, it's not possible to use a name. Your only choice is to use the column
number.
 
thank you.



Douglas J. Steele said:
No, it's not possible to use a name. Your only choice is to use the column
number.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


WDSnews said:
The addressing technique of the column object is generally presented as:

comboboxname.Column(#)

Where the number is used to identify a specific column, beginning with
zero. However, is it possible to identify the column with header text?
such as....

comboboxname.Column("ID")

In the case of a SQL statement such as SELECT [Item Types].ID AS ItemType
..... The associated column might be addressed as

comboboxname.Column("ItemType")

If it works, is there a reason not to prefer this? My goal is to allow
columns to be rearranged without having to repair code.
 
Except by the infinite flexibility of writing your own code:
iterate through the column headings and match them to
column numbers.

However, normally we used subforms where we needed
this kind of flexibility, and more often we did it the other
way around: The column titles are set at runtime to match
the column contents.

(david)



WDSnews said:
thank you.



Douglas J. Steele said:
No, it's not possible to use a name. Your only choice is to use the
column number.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


WDSnews said:
The addressing technique of the column object is generally presented as:

comboboxname.Column(#)

Where the number is used to identify a specific column, beginning with
zero. However, is it possible to identify the column with header text?
such as....

comboboxname.Column("ID")

In the case of a SQL statement such as SELECT [Item Types].ID AS
ItemType ..... The associated column might be addressed as

comboboxname.Column("ItemType")

If it works, is there a reason not to prefer this? My goal is to allow
columns to be rearranged without having to repair code.
 
Back
Top