Prevent click event from firing twice on doubleclick

I had an issue today where I kept getting error reports from a user. The procedure in question exports a file, and the error report kept saying the file was busy. I told him he couldn’t do a “fresh” export if the file was already open. He insisted it wasn’t and after a while, the root cause suddenly dawned. The user was double clicking the command button, so when the 2nd mouse-click event ran, then obviously the file exported during the first click event was open and busy.

Now one could argue that its a matter of training users, but still, I wondered if there was a simple way to prevent a mouse event from firing twice, if double clicked. And it turns out there was, quite simply in the double-click event of the command button simply put

and your are all set. If you wanted to add some training for the users, you could put a msgbox in there with a sassy message “One click will suffice”

Ask a question, leave some feedback, post a reply!