Results 1 to 3 of 3
  1. #1
    JGravesNBS
    Guest

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

    I have a form name frm_TOC_BP_ACD that has a Record Source of tblBPermit that is used for data entry purposes.

    For lookup purposes I have a Criteria form which builds a query, qryResultsBP based on desired operator criteria.

    I have a button on the Criteria form, which performs the following commands:

    DoCmd.OpenForm "frm_TOC_BP_ACD", , "qryResultsBP"

    frm_TOC_BP_ACD is opening with record source of tblBPermit instead of qryResultsBP.

    I

  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 Forms Record Source (Using Access 2000 (9.0.4402) SR-1)

    >>DoCmd.OpenForm "frm_TOC_BP_ACD", , "qryResultsBP"<<

    The 3rd option in the OpenForm method is a filtername, not a recordsource. You could pass the recordsource name in the Arguments option, and then have the form set the recordsource in its Open event.
    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 Forms Record Source (Using Access 2000 (9.0.4402) SR-1)

    Hi Mark

    Thanks for your reply

    Find enclosed another response for your interest.

    Specifying a filtername only applies anything found in the WHERE clause of
    that query to the existing Record Source -- it does not use that query as
    the new Record Source. If the query is based on tblBPermit, then it should
    work. If it's based on another table that has a similar field structure,
    then it won't work (I'm surprised it doesn't give you an error).

    One way to do it would be to open the form hidden, change its Record Source
    property, then reveal it.

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

    >
    > Change Forms Record Source
    >
    > Using Access 2000 (9.0.4402) SR-1
    >
    > I have a form name frm_TOC_BP_ACD that has a Record Source of
    > tblBPermit that is used for data entry purposes.
    >
    > For lookup purposes I have a Criteria form which builds a query,
    > qryResultsBP based on desired operator criteria.
    >
    > I have a button on the Criteria form, which performs the following
    > commands:
    >
    > DoCmd.OpenForm "frm_TOC_BP_ACD", , "qryResultsBP"
    >
    > frm_TOC_BP_ACD is opening with record source of tblBPermit instead of
    > qryResultsBP.
    >
    > I'm trying to use one form frm_TOC_BP_ACD for two record sources.
    >
    > How can I get frm_TOC_BP_ACD to open with record source of
    > qryResultsBP?
    >
    > Thanks, John Graves
    >
    > 1139nb
    >

Posting Permissions

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