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 / July 2007

Tip: Looking for answers? Try searching our database.

Setting first row in combo box as default.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Proko - 13 Jul 2007 17:58 GMT
Is it possible to set the first row in a combo box as a default selection.
The combo's list is dynamic with its list dependant on a selection made in
another combo box. To explain a little more; I select a value in combo box 1.
Combo box 2 then has its list generated. I would like the first value in
combo box 2's list to be automatically selected. Any help would be greatly
appreciated. Thanks.
Jeff Boyce - 13 Jul 2007 18:19 GMT
A quick search on-line reveals a Microsoft KB article (105519) that shows
you can use:

   Me!<ControlName> = Me!<ControlName>.ItemData(0)

to set the contents of the control (combo box) to the 1st (ItemData(0))
value in the combo box.

If your combo box uses the column names as headers, you'd use ItemData(1).

Regards

Jeff Boyce
Microsoft Office/Access MVP

> Is it possible to set the first row in a combo box as a default selection.
> The combo's list is dynamic with its list dependant on a selection made in
[quoted text clipped - 3 lines]
> combo box 2's list to be automatically selected. Any help would be greatly
> appreciated. Thanks.
Proko - 13 Jul 2007 18:38 GMT
Thankyou so much!! Works great.

> A quick search on-line reveals a Microsoft KB article (105519) that shows
> you can use:
[quoted text clipped - 18 lines]
> > combo box 2's list to be automatically selected. Any help would be greatly
> > appreciated. Thanks.
Marshall Barton - 13 Jul 2007 18:32 GMT
>Is it possible to set the first row in a combo box as a default selection.
>The combo's list is dynamic with its list dependant on a selection made in
>another combo box. To explain a little more; I select a value in combo box 1.
>Combo box 2 then has its list generated. I would like the first value in
>combo box 2's list to be automatically selected. Any help would be greatly
>appreciated.

After you set combo2's rowsource or requery it, use
Me.combo2 = me.combo2.Itemdata(0)

Signature

Marsh
MVP [MS Access]

 
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



©2008 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.