Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Referencing subform object (2002)

    I have a mainform named MainEntryForm, a subform named Transition. The transition subform contains a subform called TransCOS with a text object named DefGrade. I am trying to use the contents of the DefGrade object as the default value for a field located in the TransCOS form.

    This is what I tried: Forms!MainEntryForm!Transition.form!TransCOS.form! DefGrade
    I get the following error when I try this using a ? in front of the code above in the immediate window: Error 438 Object doesn't support this property or method.

    I can get it to work if I open the TransCOS form as a stand alone form and reference it as: Forms!TransCOS!DefGrade but not when I try to reference it as a subform of Transition.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Referencing subform object (2002)

    When referring to a subform, you must use the name it has as a control on the parent form. This is not necessarily the same as the name it has in the database window (= the source object)
    - Open MainEntryForm in design mode.
    - Click once on the Transition subform to select it. Don't click a second time, for then you will select something on the subform.
    - Note the name of the subform control in the Object dropdown on the Formatting toolbar, or in the title bar of the Properties window. This is the name you must use.
    - Click once on the TransCos subform in the Transition subform.
    - Not the name of the subform control.

    By the way, it seems strange to use a value from a subform as default value of a field in the parent. Usually, a subform may contain multiple records corresponding to one record in the parent form, so the value you retrieve would depend on whatever happens to be the current record in the subform.

  3. #3
    3 Star Lounger
    Join Date
    Dec 2000
    Location
    Manassas, Virginia, USA
    Posts
    363
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Referencing subform object (2002)

    Thanks for your help. After following your specific directions everything worked like a charm. The subform does link automatically by the student number to the main form but since they have to enter the grade level and school year 4 or 5 times for each student I thought I could make it easier for them by having a default value for those two fields and they would just need to type the course name and credits for the course.
    Judy Jones, Computer Training Specialist
    Manassas, Virginia

Posting Permissions

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