Solved

VBA Combo Box will not release focus

Posted on 2009-05-18
3
390 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Tags from access to excel 3 31
Change AD password via MS Access DB 2 20
Running sum query 6 33
append to an ms access field 6 26
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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 retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

867 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

18 Experts available now in Live!

Get 1:1 Help Now