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

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Change Forms Record Source (Using Access 2000 (9.0.4402) SR-1)

    Author
    Topic
    #1770400

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1787013

      >>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.

      • #1787043

        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
        >

    Viewing 0 reply threads
    Reply To: Reply #1787013 in Change Forms Record Source (Using Access 2000 (9.0.4402) SR-1)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information:




    Cancel