jwcolby
jwcolby at colbyconsulting.com
Mon Jun 20 16:48:29 CDT 2011
You are not missing anything except a discussion of how the form knows it needs to requery something. That "how does it know" is exactly what a message class is about. Once you have that you can raise a message when something changes and announce that change with a message. Anything else in as many locations as desired can sink the messages and "know" that something changed and that it needs to do something. A combo is a class which raises events. What would you think if Access told us "You have to program the combo to know exactly what needs to happen when the combo After update fires"? IOW, you have to tell the combo that when the combo fires it needs to tell formXYZ to requery it's recordset and and form ABC to requery it's combo and form SDF to requery it's lists and... That is nuts. The combo raises an event and doesn't care who is listening. The combo just says "Hey, I changed". What happens when that event fires is entirely up to you the programmer. that is the essence of events. Take my example and play with it. It is trivial to put these in a little database and play around. In my case, as I mentioned, I have a subform adding or subtracting cities to a table. There are several places in different forms where as the table changes things need to requery. My subform that adds cities simply "raises an event" (a message) saying "the list of cities changed". That subform has no business saying "the list of cities changed so... formXYZ, requery your recordset and FormASDF requery your lists and form ZXC requery your combos". In other words it is not the city add subform's business to tell other code what to do, it is just that form's business to say "cities changed". John W. Colby www.ColbyConsulting.com On 6/20/2011 5:31 PM, Stuart McLachlan wrote: > I generally just use Forms!MyFom.Requery or Forms!MyForm.MyControl.Requery. > > Or am I missing something? >