inibit click event in combobox

User avatar
sal21
PlatinumLounger
Posts: 4376
Joined: 26 Apr 2010, 17:36

inibit click event in combobox

Post by sal21 »

In the click of a combobox I have a routine that starts a

code:
....
while not. eof

wend
....

this cycle is verylong.

How can I inhibit a second click on the combobox until it is completed on the first event?

User avatar
HansV
Administrator
Posts: 78668
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: inibit click event in combobox

Post by HansV »

Declare a variable at the top of the module:

Code: Select all

Private blnExit As Boolean
In your event procedure:

Code: Select all

Private Sub ComboBox1_Click()
    If blnExit Then Exit Sub
    blnExit = True
    ' your code here
    ...
    blnExit = False
End Sub
where ComboBox1 is the name of the combo box.
Best wishes,
Hans