Access Form Combo Box

K

Kevin Davis

Aloha,

I have a quick question I have Combo Box A and Combo Box
B. Combox B is filled as a result of Combo Box A. I
would like to delete all the information first in Combo
Box B before it is populated (me.drpSeatId.additem
(iSeatID)). I have tried the RemoveItem but it errors
out becuase it cannot locate the item. Is there a method
that will clear the combo box?

Mahalo,

Kevin
 
J

Jeff Boyce

Kevin

Are you saying that you want the selection of a new item in ComboBoxA to
result in a new list of items in ComboBoxB? If so, wouldn't that "delete
all info in ComboB" before replacing with a new list?

If your ComboBoxB is already "filled as a result of ComboBoxA", I have to
assume that you've added a line of code in your ComboBoxA_AfterUpdate event
that is something like:
Me!ComboBoxB.Requery

Could you explain a bit more why you feel the need to remove the items from
B before requerying?

Good luck

Jeff Boyce
<Access MVP>
 
K

Kelvin

If you want to remove all the entries, then remove item 0, which is the
first item in the list. This will renumber the rest down one. Put this in
a loop until you get an error which means there are no more items in the
list.

Kelvin
 
K

Kevin Davis

Let me try to explain, I am using Combo Box A (CustomerID)
and B (SeatID) as a filter for a query which will return
me all the applications that a customer may have mapped
to a particular seat. When I select a Customer from
Combo Box A I would like to have Combo Box B populated
with only the seats assigned to that particular
individual not every seat in the database. Then I build
the query which returns to me in a text box the
applications that are mapped to that individual at that
particular SeatID. Is this clear as mud?? :)

Aloha,

Kevin
 
J

Jeff Boyce

Kevin

If the source of your second (B) combo box includes a criterion of whatever
value is in the first (A) combo box, and your first combo box's AfterUpdate
event includes a line of code that says something like:

Me!ComboBoxBName.Requery

then every time you pick another (A) value, (B)'s row source requeries.
Since you've included a criterion in the query that says to look at:

Forms!YourFormName!ComboBoxAName

your (B) combo box gets refreshed.

This is predicated on what data structure your table have -- you'd have to
have a table somewhere that actually has the value of CustomerID and SeatID
in the same row.

Good luck!

Jeff Boyce
<Access MVP>
 

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