Solved

How do I stop combo box from going to end of first found record?

Posted on 2013-06-25
15
344 Views
Last Modified: 2013-07-12
Using MS Access 2007 I have created a bound combo box that has a query as its RowSource. When I type in a number I want it to display the entries in the rowsource and let me progressively enter the numbers and see the matchin results. For some reason as soon as it finds a record that commences with the first number(s) I enter it automatically selects that record and jumps to the end of the field. How do I stop this and force it to display a list.

E.g. The RowSource has records that look like the following. As soon as I enter 3 in the combo box it automatically selects the first record that commences with a 3 and fills the box. I want it to simply display the entries starting with 3 and let me keep typing:
1000234625638752
2000456825895236
3000285864265848
3000864965246297
3000958746388468
0
Comment
Question by:Rob4077
  • 7
  • 4
  • 4
15 Comments
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Are you sure the value is being selected and not just suggested?  When you type a character, Access displays (as a suggestion) the first value that satisfies the selection but if you type more characters it changes the suggestion to fit what you have typed.
0
 

Author Comment

by:Rob4077
Comment Utility
No, it fills the entire box with the number and moves the cursor to the end of the field. I've used combo boxes before and not seen this behaviour so I was wondering if I had perhaps changed a setting or something.
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
Do you have any code in any combo box event  (for this combo box, clearly)?
0
 

Author Comment

by:Rob4077
Comment Utility
Yes I have an On Got Focus event that does a requery of the rowsource (the rowsource is a list of all numbers that have not yet been allocated) and an After Update event that checks to make sure the entered number is not already in the bound table (the allocated numbers). There is no On Change event - if there were an On Change event I would expect this type of behaviour may be possible.
0
 
LVL 77

Expert Comment

by:peter57r
Comment Utility
I think you will have to try running without any code to see if makes any difference.

Comment-out  all of it and see what happens and then uncomment one event at a time to try to pin down the source of the problem.
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 300 total points
Comment Utility
Make sure the "AutoExpand" property of the combobox is set to: Yes

...and let's be clear on this, as Pete stated...
"I want it to simply display the entries starting with 3 and let me keep typing:"
A combobox will not "Filter" a list, it will jump to the first matching entry if you simply start typing into it...
It will "jump to" all values that match what you start typing, only IF you drop the box down first.
(Again, this is not "filtering" the list for matching entries)

For example, this attached database works just fine for me...
Sample.mdb
0
 

Author Comment

by:Rob4077
Comment Utility
Sorry, I keep getting called away to other projects. The way your combo box works is exactly how I thought it should. It displays the records commencing with the number(s) entered. Mine enters the number in the field and moves the cursor to the end of the number as soon as it finds the first match. I will try to have another look at it tomorrow to see if I an figure out what I am doing wrong.
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
Again:
"Make sure the "AutoExpand" property of the combobox is set to: Yes"
0
 

Author Comment

by:Rob4077
Comment Utility
Hi Boag2000. Just confirming that the AutoExpand property is and was set to Yes. As soon as I enter a 3 it selects the first record starting with 3 and jumps to the end of it ready for me to type in additional numbers.

However I figured out what it was that was causing the problem. I had an input mask of 0000\ 0000\ 0000\ 0000;;" "
to make it easier to read and that appears to cause problems. When I inserted the same input mask in the sample database I get the same outcome.

So is there any other way of making the numbers appear in groups of 4 digits for clarity?
0
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 200 total points
Comment Utility
Remove the input mask and set the Format property to :

@@@@-@@@@-@@@@-@@@@
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
I think Pete has your solution there...
0
 

Author Comment

by:Rob4077
Comment Utility
Indeed he has. Thanks Pete! I will share points for contribution.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
Comment Utility
No need to share the points, Pete has answered your question directly.
;-)
0
 

Author Comment

by:Rob4077
Comment Utility
True but your sample db lead me to realise what gave rise to the problem
0
 

Author Closing Comment

by:Rob4077
Comment Utility
Sorry for the delay. I thought I had closed it out
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

771 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

13 Experts available now in Live!

Get 1:1 Help Now