Hi all,
How do I add the values to the combo box using programming?
And show only the name and hide the rest? I'm trying to do
a select query from the user table and from the query
result, I apply the result to the combo box.
Let say,
Dim rd as dao.database
dim rst as dao.recordset
dim str as string
str = "SELECT userId,uname FROM USER"
set rd=currentdb()
set rst=rd.openrecordset(User)
If rst.RecordCount > 0 Then
With Me.combox1
.RowSourceType="Table/query"
.RowSource=str
//From Here, How do I show only the user name and not
the user ID ??
end with
Thanks,
J.B.
John - 01 Dec 2003 15:26 GMT
James
Have you looked at the control properties for the combo box? Specifically the Column Count under the Format Tab. If you set this to 1 it will only show 1 column
HTH
John
James B - 01 Dec 2003 15:47 GMT
Yes I did. But I also like to know how to do show the
column using programming. And with that, I need to know
how to hide the userId column and show the username column.
Thanks for the help.
J.B.
>-----Original Message-----
>James,
>
>Have you looked at the control properties for the combo box? Specifically the Column Count under the Format Tab.
If you set this to 1 it will only show 1 column.
>HTH,
>
>John
>.
Marshall Barton - 01 Dec 2003 15:50 GMT
>How do I add the values to the combo box using programming?
>And show only the name and hide the rest? I'm trying to do
[quoted text clipped - 19 lines]
> //From Here, How do I show only the user name and not
>the user ID ??
Make sure the combo box's column count property is set to 2.
Then set the ColumnWidths property to 0;
the 0 width column will not be displayed in the drop down
list and the second column will be the one displayed in th
combo's text area.

Signature
Marsh
MVP [MS Access]
James B. - 01 Dec 2003 16:10 GMT
Thanks
>-----Original Message-----
>>How do I add the values to the combo box using programming?
[quoted text clipped - 26 lines]
>list and the second column will be the one displayed in th
>combo's text area.