Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Change SubForms Record Source (Using Access 2000 (9.0.4402) SR-1)

    Hi All

    In the past, you provided me this suggestion to change record source and it works great!

    ' following code changes record source for frm_TOC_BP_ACD from tblBPermit to qryResultdBP

    DoCmd.OpenForm "frm_TOC_BP_ACD", WindowMode:=acHidden
    Forms!frm_TOC_BP_ACD.RecordSource = "qryResultsBP"
    Forms!frm_TOC_BP_ACD.Visible = True

    Now I want to open an unbound Form called frmMain with a Datasheet Sub Form called frmDetail and change the record source of frmDetail to qryResultsBP.

    Can this be done?

    If so could you show me to proper command syntax?

    Thanks, John Graves

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Change SubForms Record Source (Using Access 2000 (9.0.4402) SR-1)

    >>Now I want to open an unbound Form called frmMain with a Datasheet Sub Form called frmDetail and change the record source of frmDetail to qryResultsBP.<<

    First, we need to know the name of the subform control on the mainform that contains form frmDetail. Let's call it subDetail. To change its recordsource from the main form, all you need is:

    me.subdetail.form.recordsource="qryResultsBP"
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change SubForms Record Source (Using Access 2000 (9.0.4402) SR-1)

    This worked for me

    ' following code changes record source for form from tblBPermit to qryResultdBP
    DoCmd.OpenForm "frmqrytblBPermitColSelectedMainForm", WindowMode:=acHidden
    Forms!frmqrytblBPermitColSelectedMainForm!frmqrytb lBPermitColSelectedSubForm.Form.RecordSource = "qryResultsBP"
    Forms!frmqrytblBPermitColSelectedMainForm.Visible = True

Posting Permissions

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