Columns in a Select statement

R

RICHARD BROMBERG

I have a combobox with the following called cmboSelectCategory with the
following Row Source

SELECT [NAME], [PHONE], [ADD] FROM PHONE WHERE
[PHONE].[CATAGORY]=[Forms]![PHONE]![cmboSelectCategory];







I am using the following procedure to set a label caption

Private Sub cmboSelectName_AfterUpdate()

lblName2.Caption = [Forms]![PHONE]![cmboSelectName]

End Sub



This works okay to set the label caption from the first column in the Select

How do I change the procedure to set the label from the second or third
column?



Thanks
 
S

Steve C

RICHARD BROMBERG said:
I have a combobox with the following called cmboSelectCategory with the
following Row Source

SELECT [NAME], [PHONE], [ADD] FROM PHONE WHERE
[PHONE].[CATAGORY]=[Forms]![PHONE]![cmboSelectCategory];







I am using the following procedure to set a label caption

Private Sub cmboSelectName_AfterUpdate()

lblName2.Caption = [Forms]![PHONE]![cmboSelectName]

End Sub



This works okay to set the label caption from the first column in the
Select

How do I change the procedure to set the label from the second or third
column?



Thanks

Hi Richard.

lblName2.Caption = [Forms]![PHONE]![cmboSelectName].Column(1)

The columns are zero based, so column(0) is the first, column(1) is the
second, column(2) is the third etc.

HTH
SteveC
 
M

Maurice

Richard try this:

lblName2.Caption = [Forms]![PHONE]![cmboSelectName].column(1)

this will show you the values from the first column (not the id) if you want
the second place a 2 or a 3 or .....

remember column(0) is the first field in the select statement.
 

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