Results 1 to 2 of 2
  1. #1
    Calego is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2015
    Posts
    10

    Setting RecordSource from one subform to another

    I've searched around for the answer to this and can't seem to find a solution for my particular situation. I have a form with two subforms. The two subforms are not like one is the subform of the other. They are both on the same level inside the main form. The main form does not have a table or query assigned to it. I'm trying to get subform2 to show all records associated with an ID in the current record in subform1. So I'm using the "On Current" even in subform1 to trigger the code that is supposed to change the RecordSource in subform2. The problem is that I keep getting errors when trying to reference the RecordSource property of subform2 from within subform1. The way I'm referencing it is:
    Me.Parent![Item-Activity subform].Form.RecordSource

    The way I'm testing it is that I have "MsgBox Me.Parent![Item-Activity subform].Form.RecordSource" and that triggers the error:
    "You entered an expression that has an invalid reference to the property Form/Report.

    I don't know what is wrong with my reference. Maybe there is a better way to do this?

    The reason for the two subforms inside the main form is because I want both forms to be in Datasheet View only. If I try to assign the "parent" form to the main form, make it Datasheet View, and then add the "child" form as a subform, the result is the "parent" form with "+" signs. The "+" signs open up to the associated records in the subform. At first I thought this was kind of neat, but actually I don't like this. I want the two tables to be separate -- and both in Datasheet View. If there is an optimal way to achieve this I'm all ears.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,528
    if you are calling it from the parent form , you dont need to reference the parent,
    just the name of the box the subform is in...

    [Item-Activity subform].Form.RecordSource = "qsMyData"

    i use 1 sub form and Tabs. when user click the PHONES tab, i reset the source of the sub form:

    select case Tab.value
    case "Phones"
    child1!form.recordsource = "qsPhones"


Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 03-23-2012, 01:38 PM
  2. Setting RecordSource Dyamically
    By Paul H in forum Forms
    Replies: 4
    Last Post: 09-16-2011, 08:49 AM
  3. Setting Recordsource for Subforms
    By P5C768 in forum Forms
    Replies: 5
    Last Post: 11-16-2010, 05:01 AM
  4. Update Subform Recordsource
    By mystifier in forum Forms
    Replies: 8
    Last Post: 11-15-2010, 03:03 AM
  5. update recordsource of subform
    By AndyKim in forum Forms
    Replies: 1
    Last Post: 06-16-2009, 09:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums