Solved

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

Posted on 2013-06-25
15
357 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 4
15 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 39277280
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
ID: 39278390
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
ID: 39278432
Do you have any code in any combo box event  (for this combo box, clearly)?
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:Rob4077
ID: 39280886
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
ID: 39281452
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
ID: 39287706
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
ID: 39289622
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
 
LVL 74

Expert Comment

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

Author Comment

by:Rob4077
ID: 39292488
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
ID: 39292553
Remove the input mask and set the Format property to :

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

Expert Comment

by:Jeffrey Coachman
ID: 39294653
I think Pete has your solution there...
0
 

Author Comment

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

Expert Comment

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

Author Comment

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

Author Closing Comment

by:Rob4077
ID: 39320660
Sorry for the delay. I thought I had closed it out
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
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…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

690 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