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

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.
 
D

Douglas J. Steele

No, it's not possible to use a name. Your only choice is to use the column
number.
 
W

WDSnews

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.
 
D

david

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top