Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2002
    Posts
    72

    Unanswered: referencing subforms

    I have a form called 'parent' and a subform called 'sessions'. I am trying to referenec a field in the 'sessions' subform from with the 'parent' form. What's the correct syntax to do this, I am using the code below but it don't work! The field I am referencing is 'Comments'.


    Forms!Parent!Sessions.Form!Comments

  2. #2
    Join Date
    Jul 2002
    Posts
    15
    sessions!comments should work. Or, forms!parent!session!comments

    Good luck!
    Jill

  3. #3
    Join Date
    Jun 2002
    Location
    Mpls/St.Paul area
    Posts
    303
    Your example, Forms!Parent!Sessions.Form!Comments looks correct. The Microsoft knowledge base says,

    To refer to a control on a subform, use the following syntax:
    Forms![main form name]![subform control name].Form![control name].


    The only suggestion I can offer, is to try renaming things.
    1) Don't ues an Access reserved word for a form name.
    2) try tags in the front

    Form1 = frmMain
    From2 = sbfrmSession
    txtbox = txtComments

    Then try the syntax you have already tried.

    Forms!frmMain!sbfrmSession.Form!txtComments
    John
    This is the day the Lord has made, I will rejoice and be glad in it.

  4. #4
    Join Date
    Jun 2002
    Posts
    33

    this is the solution

    In a recent application that I did I used the following statements:
    Me.frmMoves_subform_2.SetFocus
    Me.txtDestination.Value=Me.[frmMoves_subform_2]!Location.Value

    a)First I set the focus to the subform
    b)I fill the text box Destination with a value from a text box Location from that subform

    I hope that this will help you

    Bye
    PacuIonut

  5. #5
    Join Date
    Jul 2002
    Location
    Australia
    Posts
    147
    Find attached a handy document listing syntax for referring to subforms.

    Cheers,
    Andrew
    Attached Files Attached Files
    There have been many posts made throughout the world.
    This was one of them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •