Why does Access 2007 fire the on click event when a tab control is clicked?

By jgitter ·
I'm fairly new to Access 2007 development but this makes no sense. The first field on a multi-tab data entry form is a required field. The user must enter data in the field before leaving it. But I also want to give a user the option to quit adding a record using a command button. I've created a global variable to indicate cancel status. It is set to false when the form loads and true when the cancel button is clicked. In the lost focus event of the form field I have code to ensure that something (anything) has been entered. This works okay until I click on another tab on on tab control. That fires the click event to the command button which blows up my validation. Why would clicking on a tab control fire the on click event of a command button? Can anyone help with this?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by Slayer_ In reply to Why does Access 2007 fire ...

Are you clicking the button then the tab?

You said your field (I assume a text box?) has lost focus validation to insure you have data in the box?

If you click another tab, the lost focus event doesn't always fire for the control you were in (Don't ask why, I don't know). Easiest solution I find is in the click event of the Tab, put a
call sendkeys("{tab}")

Now, this cancel button, what does it cancel, the validation, or are you trying to cancel some large process?

Too bad we can't just do a remote assistance session.

Related Discussions

Related Forums