Columns in a Select statement

  • Thread starter Thread starter RICHARD BROMBERG
  • Start date Start date
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
 
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
 
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.
 
Back
Top