Solved

VBA Combo Box will not release focus

Posted on 2009-05-18
3
389 Views
Last Modified: 2013-11-28
I am trying to set a combo box on an Access form to a value not present in the drop down list, which is empty. If I enter data, and try to set focus elsewhere on the form I am unable to do so - the empty drop-down box appears. If I delete all the entered data then I can move the focus away.  What do I have to do in order to set the value in the combo box?
0
Comment
Question by:SimonKravis
  • 2
3 Comments
 
LVL 84
ID: 24417690
If the dropdown is empty, you'd have to add the value to your combo's recordsource in order for it to display later. for example, if you have a combo, and you add the value "Bob" to it, Access will store that value in the combo's underlying field, but it will NOT store that value in the combo's underlying recordsource (i.e. whatever supplies the combo's RowSource). So if you navigate over to a different record, then back to the first record, then your combo won't show the stored value, since it won't be in combo's rowsource.
0
 

Author Comment

by:SimonKravis
ID: 24417911
Does a VBA combo box allow entry of values not in the dropdown list? A VB one does, but VBA controls are often subtly different. If it doesn't then what I want to do isn't possible.
0
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 24421128
If you set the LimitToList property to No, Access will let you add anything you want in the combo. It will NOT, however, automatically add that to the Recordsource/RowSource of that control ... you must do that. The LimitToList and NotInList Event help topics explain this pretty thoroughly, with very good examples.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now