Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox.clear problem 1

Status
Not open for further replies.

Jamesm601

Programmer
Feb 6, 2004
27
US
Hello all.

I have a userform with a three comboboxes. The first two define the criteria for what's to be displayed in the third. The code that evaluates the states of the first two comboboxes resides in the Dropbuttonclick() event of the third.

Code:
'Below code is in a Do loop that loops through all possible entries:
if region = Regioncombobox.value and Prioritycombobox.value = "High" then
  projectcombobox.additem region
end if

My problem is that in order to allow the user to drop down the third combobox without duplicate entries appearing, i've placed...
Code:
 Projectcombox.clear

in the Dropbuttonclick() event. This works, but prevents me from selecting from that list, because selecting calls the Dropbuttonclick() event which clears the list.

Does anyone know where I could place the Combobox.clear command so that it would clear the list before repopulating it, but not before selecting?

Thanks in advance for any help.
 
Hi Mintjulep

Actually, I'm already doing that with one and two. But the user won't necessarily be leaving those boxes every time. I need to make it so they can click on the third combobox multiple times without the list doubling, then tripling, etc.

Thanks.
 
You are .add items on box3 enter event, right?

How about skipping the .add if there are already items?

if box2.list.count = 0

with box3

.add
.add

 
Mintjulep,

You are the best. That works perfectly. Don't know why I didn't think of it myself.

Thanks a million.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top