Combobox_change event problem

G

Guest

I have a form that uses a combobox to fill in the textboxes on the form to be
edited using the change event. Work great but when the text boxes are all
edited and the user press the OK button to copy the fields to the worksheet
as soon as it gets to the first
..cells(4, 1).Value = frmEditText.txtbxName.Value
It immediatley goes to the combobox_change event, which resets the form.
Any way around this or a way to turn off the combobox_change event
temporarily while the code fills in the proper cells?????
 
G

Guest

Hi,
You could use a variable to track whether the event should be processed or
not:
'form level variable
Private ProcessingOk as boolean

'in your CmdOk_Click sub, set processingOk
Sub CmdOk_Click( )
ProcessingOk=True
' ... processing code here
ProcessingOk = False
End Sub

'in your other controls event subs, process only if Not OrocessingOk.
'Eg
Sub combobox_change ( )
If Not ProcessingOk Then
'your regular code here
End if
End Sub
 

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