View Full Version : Order of Events for Multipage Form w/TabControls


TGHockett
03-27-2001, 01:40 PM
I have a form with three tab controls as follows:

Tab 1 - main form for proposal specific information
Tab 2 - continous subform to select models to include to include in the current proposal
Tab 3 - a two-part form; the top is single form, and the subform shows the models entered in Tab 2 for entering other cost related information.

This works fine with the major hassel that the subform on Tab 3 doesn't automatically requery to show the records added in Tab 2 until the user starts entering data.

I thought the easy answer was to add a macro to requery the subform on Tab 3 to refresh the data when this tab is selected, but after trying open/enter etc events for both forms on Tab 3, I either get no reaction, or Acc2k says they can't find the control I am trying to reference to update.

One basic quesiton I have is: on this type of multipage form with tab controls -- when do the subforms open? I initially thought all four forms would open when the main form did and I would use the get focus or current events, so all thoughts welcomed...

TGH

Pat Hartman
03-27-2001, 05:50 PM
Once you get subforms and tabs the events get a little complicated and it's impossible (for me anyway) to work out what order they will execute in. So, what I do is put msgbox popups in the Open, Current, and what ever other events I think I might need. The message boxes display the name of the form and the name of the event. Then I log what happens as I open the main form. It can be tedious but I haven't found a better way.

TGHockett
03-27-2001, 06:36 PM
Thanks Pat -- great idea!

Still curious though if the general rule is that opening the main tab form automatically opens the other forms on the subsequent tabs... guess I will find out http://www.access-programmers.co.uk/ubb/smile.gif

TGH

TGHockett
03-28-2001, 06:48 PM
Just wanted to let you know, Pat, that your idea worked just fine, though a bit tedious, as you knew it would be.

For people with this type of problem in the future, a couple of things I learned:

1: The Open/current events fired off just as Acc2k docs said -- the last nested subform (tab 3b)first, then the subform (tab 2), followed by the tab 3a (parent to 3b) and finally by the main form (tab 1).

2: Since I wanted the requery to occur when I selected the third tab, the key was using the "enter" event for that subform, which is only found by viewing the subforms property from the Main form view (not the usual Form view for the subform itself).

3: Even after I pinpointed the right event to use, I still couldn't use the standard requery action since Acc2k refused to acknowledge the subform (3b) when tab 3 was selected.... ironically a simple Sendkeys {F9} did the trick beautifully http://www.access-programmers.co.uk/ubb/smile.gif

Thanks again Pat for pointing me in the right direction!

TGH