FormsSubformsReference.mdb |
Post Reply |
Author | |
A.D. Tejpal
Microsoft MVP Joined: 30 Jun 2008 Status: Offline Points: 192 |
Post Options
Thanks(0)
Posted: 08 Jul 2008 at 10:50pm |
This sample db demonstrates execution of following types of tasks while simultaneously displaying the code involved: -Referring to controls of one group of nested subforms from another group of nested subforms: (a) There are two adjacent sets of nested subforms, each three levels deep. (b) Dbl clicking any text box identifies it as Target Control. Thereafter, Dbl clicking any other text box identifies it as Base Control. (c) Code in the subform containing Base Control, acts upon Target control and also sets focus on to it. Simultaneously, this code gets displayed at bottom of main parent form. (d) For each situation, two alternative styles of VBA code are shown (with and without use of bang (!) operator). (e) Extreme case involves Base Control in innermost nested subform at left, acting upon Target Control in innermost nested subform at right (i.e. going up-hill across three levels of parent forms and then down-hill across three levels of subforms). 4.3 - (i) Query using values represented by controls on forms / nested subforms, (ii) Referring to subroutines (contained in form's modules) across various levels of nested subforms: (a) Here too, two adjacent sets of nested subforms, each three levels deep are used. (b) Dbl clicking any text box on main parent form or various nested subforms at left, causes its value to be picked up by the query, results of which, are displayed in the innermost nested subform at right. (c) Simultaneously, the SQL used in source query, gets displayed at bottom of parent form. (d) VBA code used for calling a subroutine contained in the module of innermost nested subform at right, from various levels of nested subforms at left, is also displayed. Note - (a) In a query, reference to form controls is feasible only by using bang (!) operator. (b) In VBA code, parenthesis can be used in lieu of bang (!) operator and are preferred. (c) Thumb rule: Use Dot for one to many situation. Use bang (!) or parenthesis for many to one situation e.g member of a collection.
|
|
Sponsored Links | Want a good read? Try The Summer of His Life (available on Amazon!) |
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |