Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56

    Unanswered: Grabbing data from Main form to put in Sub form

    Hey guys,

    Can anyone help with this problem? I have main form with basic data like "date" and "data entered by" and a subform with more detailed stuff.

    What I want to do is have the date field in the subform grab the value form the date field in the main form.

    I've put the code in the AfterUpdate event of the first field that needs to be filled in on the subform. It looks wrong and does not work. Any ideas?

    The main form is called "frmCardiology_MAIN" and the field is called 'cboMonthOf'

    The sub form is called "frmfrmCardiology_SUB" and the field I need the value to go into is called 'MonthOf'.

    Code:
    Private Sub Trial_Name_AfterUpdate()
    Me.MonthOf.Value = frmCardiology_MAIN!cboMonthOf.Value

    Cheers,

    Rusty

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Try

    MonthOf = Me.Parent.cboMonthOf

    assuming the data required is the bound column in the combo control

    and see if that works

    For completeness I think the origional code shouold be

    Me.MonthOf.Value = Forms!frmCardiology_MAIN!cboMonthOf.Value


    HTH

    MTB

  3. #3
    Join Date
    Apr 2004
    Location
    United Kingdom
    Posts
    56
    Thanks Mike, the code you suggested below worked a treat!!

    Me.MonthOf.Value = Forms!frmCardiology_MAIN!cboMonthOf.Value

    Cheers,

    Rusty

  4. #4
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Please to help

    MTB

Posting Permissions

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