Cannot stop switching tabs

  • Thread starter Thread starter Applebaum
  • Start date Start date
A

Applebaum

I have a form with a tab control and a subform. The subform's source gets
changed according to the tab selected.

One of the tabs uses a subform that has some required fields. If the user
tries to click on another of the main form's tab and the required fields are
not filled out, I can make a msgbox appear, but I cannot cancel the tab
action.

I've tried DoCmd.CancelEvent and Cancel = True, neither work.

I've been able to get this to work on another tab. The only significant
difference I can see is that the subform on the tab where this does work is
based on a table, and is a data entry form. The subform on the tab where it
doesn't work is based on a query, and is not a data entry form.

Any thoughts would be much appreciated!

Thanks,

Matthew
 
Applebaum said:
I have a form with a tab control and a subform. The subform's source gets
changed according to the tab selected.

One of the tabs uses a subform that has some required fields. If the user
tries to click on another of the main form's tab and the required fields are
not filled out, I can make a msgbox appear, but I cannot cancel the tab
action.

I've tried DoCmd.CancelEvent and Cancel = True, neither work.

I've been able to get this to work on another tab. The only significant
difference I can see is that the subform on the tab where this does work is
based on a table, and is a data entry form. The subform on the tab where it
doesn't work is based on a query, and is not a data entry form.

If it's not a data entry form how can there be required fields not filled out? What
event are you using and what is your code?
 
Back
Top