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 / Modules / DAO / VBA / February 2006

Tip: Looking for answers? Try searching our database.

Setting a combo box to an initial value

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Banaticus - 04 Feb 2006 14:44 GMT
I have a combo box which sets a form which sets subforms on that form.  The
only problem is that the combo box doesn't have a value when it initially
loads, it's blank.  What sort of method should I have the onLoad event call
to have the Combo box start off with a value listed?  Perhaps there's some
sort of "next" feature that would bump the combo box to the next (first)
listed value in its rowsource?
Alex Dybenko - 04 Feb 2006 18:24 GMT
Hi,
try:
Me.Combo1.DefaultValue = Me.Combo1.Column(0, 0)

Signature

Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

>I have a combo box which sets a form which sets subforms on that form.  The
> only problem is that the combo box doesn't have a value when it initially
[quoted text clipped - 3 lines]
> sort of "next" feature that would bump the combo box to the next (first)
> listed value in its rowsource?
Marshall Barton - 04 Feb 2006 19:39 GMT
>I have a combo box which sets a form which sets subforms on that form.  The
>only problem is that the combo box doesn't have a value when it initially
>loads, it's blank.  What sort of method should I have the onLoad event call
>to have the Combo box start off with a value listed?  Perhaps there's some
>sort of "next" feature that would bump the combo box to the next (first)
>listed value in its rowsource?

If it's a bound control, you probably do not want to set the
combo box's value and dirty the record.  If that's not an
issue, use:

    Me.combobox = Me.combobox.ItemData(0)

but, it's probably better to set then combo box's
DefaultValue property instead:

    Me.comboboxDefaultValue = _
                        """" & Me.combobox.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.