Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2003

Tip: Looking for answers? Try searching our database.

Add value to comb box

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
James B - 01 Dec 2003 15:01 GMT
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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.