Results 1 to 3 of 3
  1. #1
    gammaman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    56

    reference objects on subform

    I have a subform "TimeSheet" which is a child of the parent form. How do I reference using VBA the objects on the subform?
    Attached Thumbnails Attached Thumbnails pic1.jpg  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    if the parent needs to see things in the child, it would be me.child72!txtBox4 (use the BUILDER , it will get the path correct, you just pick)
    but in the child sub form, all child objects are local, msgBox txtbox4

    What are you trying to do?

  3. #3
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Your VBA would be:
    Code:
    Me.SubFormName.Form.[ControlName]
    
    Forms![MainFormName].[SubFormName].Form.[ControlName]
    The former is for referring to a subforms control if you are writing the code within the main forms module. The latter is form referring to a control on the subform from another module.

    The '.Form' is supposed to be there as such, subforms have a .Form property that links them to the parent form.

    More info on subforms: http://bytes.com/topic/access/insigh...items-sub-form
    Last edited by nick404; 08-27-2015 at 07:32 AM. Reason: added information link

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 12-19-2013, 12:34 AM
  2. Replies: 2
    Last Post: 03-23-2012, 05:02 AM
  3. Query reference to a subform
    By hawkins in forum Forms
    Replies: 3
    Last Post: 08-05-2011, 10:49 AM
  4. Creating a reference to the subform.
    By evander in forum Forms
    Replies: 2
    Last Post: 05-26-2010, 09:39 AM
  5. Can't reference control in subform
    By evanscamman in forum Forms
    Replies: 0
    Last Post: 12-25-2007, 06:47 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums