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. Download Access XP & 2K: http://www.rogersaccesslibrary.com/forum/uploads/37/FormsSubformsReference.zip - uploads/37/FormsSubformsReference.zip
------------- --
Email: mailto:adtejpal@gmail.com - adtejpal@gmail.com
|