A couple questions about combo boxes

H

Hey

Hi All,

I've got a main form (frmProductUsed) with a drop down list (cmboProduct)
that contains our products. It's ordered by Product Code that's usually 2
digits, although could be 3. If I have a product code that is equal to 451,
as I type the 4, it goes to the the first product code that starts with 4,
then as I type 5, it goes to the first one it finds that has 45 and displays
that one (say in this case the first it finds is 451). All is as it should
be, and I can click on the list or hit tab or enter to accept the one
listed. All fine.

First question:
Lets say I want to use a new a new code 45. I can't get it to recognize
that this code (only the 45 I've typed in) is not in the list--it
automatically uses 451. Is there a way to change this, but still have it
function as a listing that works as above?

2nd question: I've got a routine that if the number I've typed in isn't in
the system yet, that it says it isn't, and asks if I want to add it. That
routine is in the Not In List area of this combo box. So, I can
successfully get to that add form (except for the above problem that I've
solved by having a double-click routine that pops the add product code form
up), add my new product code, and close that form. But, the new code isn't
in the list when I get back to the frmProductUsed.cmboProduct control.
Still using the old list. If I close frmProduct and reopen it, then I'm
using a new list and the new code is there. Surely there's an easier way.
Where can I put a routine in my frmProductUsed, cmboProduct to requery the
list after I'm finished with adding a new product code via the
frmProductCode?

Thanks
 
A

Arvin Meyer MVP

Hey said:
Hi All,

I've got a main form (frmProductUsed) with a drop down list (cmboProduct)
that contains our products. It's ordered by Product Code that's usually 2
digits, although could be 3. If I have a product code that is equal to
451, as I type the 4, it goes to the the first product code that starts
with 4, then as I type 5, it goes to the first one it finds that has 45
and displays that one (say in this case the first it finds is 451). All
is as it should be, and I can click on the list or hit tab or enter to
accept the one listed. All fine.

First question:
Lets say I want to use a new a new code 45. I can't get it to recognize
that this code (only the 45 I've typed in) is not in the list--it
automatically uses 451. Is there a way to change this, but still have it
function as a listing that works as above?

In the Combo (assuming it is unbound) delete the 1
2nd question: I've got a routine that if the number I've typed in isn't
in the system yet, that it says it isn't, and asks if I want to add it.
That routine is in the Not In List area of this combo box. So, I can
successfully get to that add form (except for the above problem that I've
solved by having a double-click routine that pops the add product code
form up), add my new product code, and close that form. But, the new code
isn't in the list when I get back to the frmProductUsed.cmboProduct
control. Still using the old list. If I close frmProduct and reopen it,
then I'm using a new list and the new code is there. Surely there's an
easier way. Where can I put a routine in my frmProductUsed, cmboProduct to
requery the list after I'm finished with adding a new product code via the
frmProductCode?

You need to requery. There is generic NotInList code on my website:

http://www.datastrat.com/Code/NotInListCode.txt

and a sample app using that code at:

http://www.accessmvp.com/Arvin/NotInListDemo.zip
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top