Re: Populating ComboBox



On Feb 1, 8:12 pm, r...@xxxxxxxxxxxxxx wrote:
On Feb 1, 7:52 pm, "Dave O." <nob...@xxxxxxxxxxx> wrote:





<r...@xxxxxxxxxxxxxx> wrote in message

news:1170340113.285671.59920@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Now why is the

Combo1.ListIndex = 0

line invoking the OnClick event function of the ComboBox?

Because it is essentially the same as if a user selected the first item.
Easy to fix, set a flag. One way to do this (out of millions):

In the form declarations

Private bnBusy as Boolean

Then in the routine:
bnBusy = True
Combo1.ListIndex = 0
bnBusy = False

Then at the start of the Click event
If not bnBusy then
' Your existing code.
End If

Best Regards
Dave O.

Dave, what do you mean by "routine"? Do you mean the Form_Load sub? If
I add Combo1.ListIndex = 0 in the Form_Load sub, then VB generates the
following error:

Invalid property value.

pointing to the Combo1.ListIndex = 0 line.

Also whose OnClick event function are you referring to to add the If
condition at the start - the CommandButton's or the ComboBox's?

What I did is commented out the lines

Combo1.ListIndex = 0
bnBusy = False

in the Form_Load sub but kept the line

bnBusy = True in the Form_Load sub. & added the If Not bnBusy Then
line in the ComboBox's OnClick event function. It works when I click
the CommandButton & does the necessary but when I select an item from
the ComboBox so that I can see the records of a particular UserName,
then I can't see the individual records. All the records get
displayed. What am I doing wrong?- Hide quoted text -

- Show quoted text -

OK....OK....I got it Dave.....thanks....

.