Thursday, May 29, 2014

Cancel button takes two clicks

Issue

Over the weekend I decided the main user-form wasn't what was needed. Naturally, I created a new one since my sponsor wasn't on board yet.

Being lazy, I exported the old form, changed the name, and re-imported.

The new one had an odd behavior, or lack of it: when the Cancel button was clicked it didn't perform the Me.Hide in the btnCancel_Click event procedure, until it was clicked a second time.

What it wasn't

The code in this user-form's btnCancel_Click event procedure was exactly like that in the original form.

There was nothing in the btnCancel_Doubleclick event procedure and the time between the two clicks was a second or more as I did the usual user response when something doesn't work, i.e. click it again.

Secondary Observation

As I was putting together the email to my user in order to mention this issue was noted and (b) explain this is a small matter, I noticed I could no longer open the worksheets while the user-form was showing.

Solution

That's modal behavior.
Looking at the old and new form I changed the ShowModal property from True to False.

Lesson Learned

Apparently when a user-form is exported and imported not all property settings are carried through the process.

No comments:

Post a Comment