Results 1 to 11 of 11
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    subform name (Access03)

    I am trying to reference a subform in VBA. I used

    Me.frmTask.txtSubSectionID = Me.SubSectionID
    I get Error 2465 can't find the field "frmTask" referred...

    I have also used

    Me!frmTask!txtSubSectionID = Me.SubSectionID
    This one works on another subform on the same main form. This setup gives me Method or data member not found.

    I have also used
    Me.frmTask.Form!txtSubSectionID = Me.txtSubSectionID.
    This setup gives me Method or data member not found.

    I have pasted the names of the controls to avoid spelling errors. I have also deleted the subform and replaced it on the main form making sure the name was frmTask.

    When debugging the .frmTask is highlighted. I know that the subform can be different from the name of the form shown in the database window. So I looked in the property box for the main form and frmTask is listed as a control. When I select the subform and open the property dialog box frmTask is the name.

    Still not working. The name of the subfrom has to be the name listed in the property box doesn't it? The Intellisence programming doesn't find it when I
    start typing Me.... But I now know that doesn't mean a lot. Is there somewhere else that the name may show up differently.

    What else is there to do? Thank you. Fay

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: subform name (Access03)

    I can't tell from your post exactly what you're trying to do. If the subform is frmTask, then are you trying to set the value of a control on the subform to a value in a control on the parent form? If so, try this:

    <code>Me!frmTask.Form!txtSubSectionID = Me.SubSectionID</code>
    Charlotte

  3. #3
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform name (Access03)

    That is exactly what I am trying to do. I tried your suggestion and it didn't work either. Fay

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

    Re: subform name (Access03)

    Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  5. #5
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform name (Access03)

    Thanks I got it working using

    [Forms]![frmTasks]![txtSubSectionID]

    Thank you. I will be back with my next problem soon I am sure. Fay

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: subform name (Access03)

    In that case, your original post was misleading. That construction absolutely could not work if frmTasks were a subform because subforms are not open in the Forms collection. The syntax you posted will only work if frmTasks is a separate form, not opened as a subform.
    Charlotte

  7. #7
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform name (Access03)

    The frmTask is a sub form on frmTasks. But in the end you are correct. The correct number is displayed in the textbox as started a new record, but the number was not saved. I have attached the form the way it was when I thought I had achieved my goal. Thank you for your assistance. Fay

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

    Re: subform name (Access03)

    You have removed too much from the database. It is impossible to select a section or subsection in frmTasks since you removed the row source of the combo boxes.

  9. #9
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform name (Access03)

    Sorry I think this is working.

    Fay

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

    Re: subform name (Access03)

    If you link the subforms to the main form properly (through the Link Master Fields and Link Child Fields properties), you don't need code. See attached version, study the control source of the text boxes and theway the subforms are linked to the main form.

  11. #11
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    NJ, USA
    Posts
    617
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: subform name (Access03)

    WOW I never knew you could link that way! Thanks for letting me know that I was on the right track. I had been feeling bad, thinking I should have been able to solve this on my own. But this is a first. Thank you for your help and expertise. I test it in the original database and let you know if there is any issues. So I expect this conversation is over. Fay

Posting Permissions

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