Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    200
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Setting record source on subform

    Hi,I have a main form/subform situation where I am using two combo boxes on the main form to establish query parameters, in which once selected the second combo box triggers a "make Table" query which is used for the subforms record source. However I am running into a problem with the VBA code setting the record source. I am attempting to use "Forms![frm_subsafe_report_criter_selection]![subfrm_unauthorized_subsafe].Form.RecordSource = "tbl_Make_Table_Unauthorized_Subsafe"" to set the record source of the subform using an after update event on the second combo box on the main form. This generates an error and Access tells me it can't find the field "subfrm_unauthorized_subsafe", which in this case is actually the subform... I can't tell whats wrong in the VBA statement causing this. Can someone direct me on the right path ? PS: i have also tried "Me![subfrm_unauthorized_subsafe].Form.RecordSource = "tbl_Make_Table_Unauthorized_Subsafe"" which also generates the same errorthank you
    Kevin

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,623
    Thanks
    3
    Thanked 60 Times in 60 Posts
    I think this tip from Allen Browne will help you out. The "Form" must always precede the name of the subform. Also note that the reference should be to the name of the subform control on the main form, not the subform name.
    Wendell

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    New England (Connecticut)
    Posts
    200
    Thanks
    1
    Thanked 0 Times in 0 Posts
    that did it thank you
    Kevin

Posting Permissions

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