ComboBox Fill-in-as-you Type

J

jessrivard

I have a ComboBox on a Subform that Auto-Fills 3 text boxes. If you select
from the list the first time you can type several letters and click on the
vendor you want. If you decide you want to change the vendor you can click
on the arrow and the selection list appears you can scroll down and select a
vendor from the list. But if you beginning typing to narrow you search
beyond one letter when you click on the vendor the field are NOT populated
with the correct information.

Do I need to refresh or requery? If so could you provide a sample of what
that would look like? Would I put it after my AfterUpdate event (attached
below)?

Private Sub Supplier_Name_AfterUpdate()

Me![Address] = Me![Supplier_Name].Column(1)
Me![City] = Me![Supplier_Name].Column(2)
Me![Supplier#] = Me![Supplier_Name].Column(3)
Me![Attention].SetFocus

End Sub
 
M

Marshall Barton

jessrivard said:
I have a ComboBox on a Subform that Auto-Fills 3 text boxes. If you select
from the list the first time you can type several letters and click on the
vendor you want. If you decide you want to change the vendor you can click
on the arrow and the selection list appears you can scroll down and select a
vendor from the list. But if you beginning typing to narrow you search
beyond one letter when you click on the vendor the field are NOT populated
with the correct information.

Do I need to refresh or requery? If so could you provide a sample of what
that would look like? Would I put it after my AfterUpdate event (attached
below)?

Private Sub Supplier_Name_AfterUpdate()

Me![Address] = Me![Supplier_Name].Column(1)
Me![City] = Me![Supplier_Name].Column(2)
Me![Supplier#] = Me![Supplier_Name].Column(3)
Me![Attention].SetFocus

End Sub

If you select an entry in the supplier name combo box, the
other controls will be set. I therefore conclude that
either you are not relly selecting an entry OR Access us too
busy doing other things and doesn't have time to redraw the
other control's new values (very unlikely). In the latter
case you can try(?) adding Me.Repaint and/or DoEvents at the
end of yout AfterUpdate event procedure.

Note that you should not need any code to get the desired
effect. Just set the other text boxes control source
expression to =[Supplier_Name].Column(1)
etc.
 
J

jessrivard

Me![Supplier_Name].Repaint gives me an error message.
--
Thanks!
Jess


Marshall Barton said:
jessrivard said:
I have a ComboBox on a Subform that Auto-Fills 3 text boxes. If you select
from the list the first time you can type several letters and click on the
vendor you want. If you decide you want to change the vendor you can click
on the arrow and the selection list appears you can scroll down and select a
vendor from the list. But if you beginning typing to narrow you search
beyond one letter when you click on the vendor the field are NOT populated
with the correct information.

Do I need to refresh or requery? If so could you provide a sample of what
that would look like? Would I put it after my AfterUpdate event (attached
below)?

Private Sub Supplier_Name_AfterUpdate()

Me![Address] = Me![Supplier_Name].Column(1)
Me![City] = Me![Supplier_Name].Column(2)
Me![Supplier#] = Me![Supplier_Name].Column(3)
Me![Attention].SetFocus

End Sub

If you select an entry in the supplier name combo box, the
other controls will be set. I therefore conclude that
either you are not relly selecting an entry OR Access us too
busy doing other things and doesn't have time to redraw the
other control's new values (very unlikely). In the latter
case you can try(?) adding Me.Repaint and/or DoEvents at the
end of yout AfterUpdate event procedure.

Note that you should not need any code to get the desired
effect. Just set the other text boxes control source
expression to =[Supplier_Name].Column(1)
etc.
 
M

Marshall Barton

jessrivard said:
Me![Supplier_Name].Repaint gives me an error message.

That is not what I suggested.

Controls do not have a Repaint method, only form objects.
 

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