Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VBA Combo Box will not release focus

Posted on 2009-05-18
3
Medium Priority
?
405 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 85
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 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
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…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Suggested Courses

886 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