Reference sub forms within a form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nickvans
    New Member
    • Aug 2007
    • 62

    Reference sub forms within a form

    Hi,

    I have a form which contains a subform, both of which have multiple tabs. In one tab of the subform I have several text boxes which display data by having their source data set to (for example):

    Source=DLookUp( "[EquipmentNumber]","[qrySelectedPart Details]")

    In other forms I've created I've been able to update the value displayed in the text boxes by using Me.text_box.Req uery, however because these text boxes are in a subform, I am not sure how to reference them. The goal is to be able to click an item in a list box and have certain information displayed in the text fields.

    I've tried frmSubForm.text _box.requery, but it doesn't seem to make any difference.

    Any help would be great! Thanks!
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    Originally posted by nickvans
    Hi,

    I have a form which contains a subform, both of which have multiple tabs. In one tab of the subform I have several text boxes which display data by having their source data set to (for example):

    Source=DLookUp( "[EquipmentNumber]","[qrySelectedPart Details]")

    In other forms I've created I've been able to update the value displayed in the text boxes by using Me.text_box.Req uery, however because these text boxes are in a subform, I am not sure how to reference them. The goal is to be able to click an item in a list box and have certain information displayed in the text fields.

    I've tried frmSubForm.text _box.requery, but it doesn't seem to make any difference.

    Any help would be great! Thanks!
    Hi NickVans,

    You posted your question in the Access Articles section, where it is very unlikely to get much coverage :-) I've moved it across for you to the Access Forum.

    MODERATOR

    Comment

    • Scott Price
      Recognized Expert Top Contributor
      • Jul 2007
      • 1384

      #3
      The general syntax to refer to subforms is: Forms![MainFormName]![SubformName].Form![ControlName]

      Regards,
      Scott

      Comment

      • nickvans
        New Member
        • Aug 2007
        • 62

        #4
        Originally posted by Scott Price
        Hi NickVans,

        You posted your question in the Access Articles section, where it is very unlikely to get much coverage :-) I've moved it across for you to the Access Forum.

        MODERATOR
        Thanks! And sorry for posting it in the wrong place.

        Comment

        • Scott Price
          Recognized Expert Top Contributor
          • Jul 2007
          • 1384

          #5
          Originally posted by nickvans
          Thanks! And sorry for posting it in the wrong place.
          Not a problem! It's not all that hard to do.

          Regards,
          Scott

          Comment

          • nickvans
            New Member
            • Aug 2007
            • 62

            #6
            Originally posted by Scott Price
            The general syntax to refer to subforms is: Forms![MainFormName]![SubformName].Form![ControlName]

            Regards,
            Scott
            You, sir, are a life saver. Thanks!

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32633

              #7
              You may find (Referring to Items on a Sub-Form) helpful.

              Comment

              Working...