Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002

    Unanswered: Get values from form to put in subform

    I have a form and subform. The relationship between the two underlying tables have compound key fields so I have to enter all of these values in both forms.

    I would like to get the default value for one of these fields in the subform from the main form.

    If I use =[forms]![form name]![field name] I get a value but it isn't the value that I have in the open main form for this field. I think the value is coming from the first record of this field in the main form.

    What is the syntax for getting the value from a field in a form that is displaying onscreen?

    Someone has suggested using:

    Me!SubformName.Form!SubtxtboxName.DefaultValue = Me!MainTxtboxName.Value

    on the after update event of that control. That doesn't seem to work, but, it seems reasonable to me. Is it just a matter of syntax?


  2. #2
    Join Date
    Dec 2002
    Préverenges, Switzerland
    where is the code running?

    in "mother":
    me!mySubform.thisChildTextBox = thisMotherTextBox

    in "child":
    thisChildTextBox = Forms!nameOfMother.thisMotherTextBox


    PS: if the "mother" case, check out the real name of mySubform by opening "mother" in design view, opening the properties window, and then clicking once in the "hole" that the subform lives in (check properties¦other¦name). in my applications at least, this is NEVER the name of the form object (.SourceObject) that lives in the "hole".
    Last edited by izyrider; 11-18-04 at 15:25.
    currently using SS 2008R2

  3. #3
    Join Date
    Oct 2002
    The combo box that I want to get the value from is on the main form. When I insert the code in the after update event I get an "Error 438 Object doesn't support this property or message error"

Posting Permissions

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