Tabbed forms with multiple subform

mounty76

Registered User.
Local time
Today, 02:27
Joined
Sep 14, 2017
Messages
341
Hi All,

Attached is a sample DB of an issue I'm having. Is easier to see the DB to see the problem.

In the People Tab and then Sign on/off tab I have 2 subforms. I have code on click when you click onboard or onleave on the two subforms, in this code I have Me.Requery which requeries that form.

For two days now I've been trying all different ways to get the other subform to requery to reflect the changes....any ideas?

So when you click someone onboard both the onboard and onleave subform should requery, but I can only get the form to requery where the control is.

Any help VERY much appreciated......

Thank you
 

Attachments

This works for me.

Code:
Private Sub Onboard_Click()
    Me.Onleave = True
    Me.Onboard = False
    Me.Requery
    Me.Parent.PeopleOL.Form.Requery
End Sub

Code:
Private Sub Onboard_Click()
    Me.Onleave = False
    Me.Onboard = True
    Me.Requery
    Me.Parent.PeopleOB.Form.Requery
End Sub

Though I can't understand why you have two checkboxes.
If someone is on leave, for sure he can not be on board.
Or visa verse.

I would use only one checkbox.
 

Attachments

It's the same thing with only one checkbox.
You may want to check it too.
 

Attachments

Here's another variation you might want to check. I did something similar to KitaYama but removed on leave and kept on board, I also added option explicit, but I kept the click, KitaYama used AfterUpdate. I also used a different syntax for the references, but both should work.

Cheers
 

Attachments

Thank you so much gents, sometimes you can't see the wood for the trees! Have a great day
 
but I kept the click, KitaYama used AfterUpdate.
I rarely use OnClick event of option and check boxes. If the code in Before-Update event of these controls cancels the update, the onClick event is fired even if there's no change to the data.
In this case, if you put some validation in before update of the checkbox, and set cancel=true to prevent the save, the onclick events is fired.
I personally doesn't like it. because a requery is unnecessary. Not a big deal in this case, but the requerry causes a screen flicker for no reason.
 
Last edited:
Yes, and there are other ways to approach this. I would personally have only one list. Then, instead of a checkbox or toggle, I'd have a combo with a double click procedure to cycle through the options so I can view all the people at once. At the top of this list, I'd have another combo with an after update procedure to filter who's on board. This pattern would have the advantage of not having to check the header of the column to know what that checkbox is for, it's also more familiar for the user, I believe.
 
Thanks for the info, the sample I posted is only just that, on my main DB it's substantially bigger and also includes a 3rd option to archive someone, so the combo for options would work well for this, however I do have another subform in there (part of the original tabbed form and not the sub tabbed form) which shows people onboard and onleave, so you can see the whole picture on one screen. Thanks again gents, much appreciated....every days a school day!
 

Users who are viewing this thread

Back
Top Bottom