A-97 Column

M

Michael Conroy

Does anyone know if Access 97 has the column feature where you can pull a
column number from a combo box selection. I am using DLookup to make it work,
but I was wondering if the feature was out there under a different name or
something. Thanks
 
D

Dirk Goldgar

Michael Conroy said:
Does anyone know if Access 97 has the column feature where you can pull a
column number from a combo box selection. I am using DLookup to make it
work,
but I was wondering if the feature was out there under a different name or
something. Thanks


Are you referring to the Column property of the list and combo box controls?
So far as I can recall, that property exists in Access 97.
 
M

Michael Conroy

Yes, the combo has four columns and I want to pull the text from the second
one and display it in a text box on the same form. I just looked again and
found it however, I was just expecting to put in a column number, what does
Index as Long and Row mean?
 
E

Evi

Michael Conroy said:
Does anyone know if Access 97 has the column feature where you can pull a
column number from a combo box selection. I am using DLookup to make it work,
but I was wondering if the feature was out there under a different name or
something. Thanks

its fine in Acc97.
Just remember that the 1st column is column 0, not column 1. And the first
column is not necessarily the column you can see in the combo. Go to the Row
Source of the combo in its Properties, click in the grey area just right of
that and look at the query there in Design view to see which column you are
referring to.

MyCombo.Column(2) will get you whatever is in the 3rd column in the query
grid in design view.
With DLookups you also have to be aware of what type of data is in the
column you want to look up. The syntax is different for dates, numbers,
booleans & text.
Evi
 
D

Dirk Goldgar

Michael Conroy said:
Yes, the combo has four columns and I want to pull the text from the
second
one and display it in a text box on the same form. I just looked again and
found it however, I was just expecting to put in a column number, what
does
Index as Long and Row mean?


Index is the 0-based column number, and Row is the row number. If you don't
specify Row, you get the column from the currently selected row. So to make
your text box display the second column from combo box "cboMyCombo", for the
currently selected row in the combo, you can set the text box's
ControlSource property to:

=[cboMyCombo].[Column](1)

Note that it's Column(1) you want here, because the first column is
Column(0).

If you refer to the combo and its columns in code, you won't need the square
brackets; e.g.,

MyVar = Me!cboMyCombo.Column(1)
 

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