Set focus, without calling the tab change event?
Posted on 2011-02-12
I'm using Access 2003
I have a form with 8 tabs on it.
If a user tries to move to another tab I have code in the Private Sub TabCtl_Change() that calls a function to make sure all the fields were filled out correctly. The function checks the the form, if it finds a problem it displays an error message and then sets the focus to checkbox or text box in question. The problem is when it does this (sets focus) it jumps to the TabCtl_Change() right then and there. This causes the code to step through the function again which causes the error to display twice. How can I get around this?
The "Print" button on my form calls the same function, however it works fine because I never changed tabs in the first place.
Hopefully that makes sense, you might have to ready it a couple of times.