• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 367
  • Last Modified:

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

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
Rob4077
Asked:
Rob4077
  • 7
  • 4
  • 4
2 Solutions
 
peter57rCommented:
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
 
Rob4077Author Commented:
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
 
peter57rCommented:
Do you have any code in any combo box event  (for this combo box, clearly)?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
Rob4077Author Commented:
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
 
peter57rCommented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
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
 
Rob4077Author Commented:
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
 
Jeffrey CoachmanMIS LiasonCommented:
Again:
"Make sure the "AutoExpand" property of the combobox is set to: Yes"
0
 
Rob4077Author Commented:
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
 
peter57rCommented:
Remove the input mask and set the Format property to :

@@@@-@@@@-@@@@-@@@@
0
 
Jeffrey CoachmanMIS LiasonCommented:
I think Pete has your solution there...
0
 
Rob4077Author Commented:
Indeed he has. Thanks Pete! I will share points for contribution.
0
 
Jeffrey CoachmanMIS LiasonCommented:
No need to share the points, Pete has answered your question directly.
;-)
0
 
Rob4077Author Commented:
True but your sample db lead me to realise what gave rise to the problem
0
 
Rob4077Author Commented:
Sorry for the delay. I thought I had closed it out
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 7
  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now