[AccessD] Parent - subform control references

A.D. Tejpal adtp at airtelmail.in
Mon Sep 13 12:22:11 CDT 2010


Arthur,

    Sample code in VBA module of first subform (having control named TxtSub1) so as to fetch the value held by control named TxtSub2 on second subform belonging to subform control named fsub2 (located on the parent form) would be as follows:
'=================================
    Me.TxtSub1 = Me.Parent("fsub2")("TxtSub2")
'=================================

    Sample code in VBA module of parent form (having control named TxtMain) so as to fetch product of the values held by controls named TxtSub1 and TxtSub2 located on subforms belonging to subform controls named fsub1 and fsub2 respectively would be as follows:
'==========================================
    Me.TxtMain = Me.fsub1("TxtSub1") * Me.fsub2("TxtSub2")
'==========================================

    In this context, my sample db named FormsSubformsReference might be of interest to you. It is in access 2000 file format and is available at Rogers Access Library. Link - 
http://www.rogersaccesslibrary.com/forum/forum_topics.asp?FID=45

Best wishes,
A.D. Tejpal
------------

  ----- Original Message ----- 
  From: Arthur Fuller 
  To: Access Developers discussion and problem solving 
  Sent: Monday, September 13, 2010 20:17
  Subject: [AccessD] Parent - subform control references


  Suppose I have a form containing two subforms, call them main_frm and fsub1
  and fsub2.

  A couple of situations are of concern:

  1. A control on fsub1 needs to obtain the value of a control on fsub2.
  2. A control on main_frm obtains its value by multiplying the value of an
  fsub1 control by a value on fsub2.

  I've forgotten how these references work. Can someone remind me? I also
  remember seeing a document that spelled all this out explicitly but I can't
  locate it now that I need it. Has anyone got a link to said document?

  TIA,
  Arthur


More information about the AccessD mailing list