Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004
    Charleston, SC

    Unanswered: Two forms, one query, one report?

    Basic question (hopefully not too stupid)...

    I have two forms containing basically the same information (but two forms are definitely needed). I need to be able to run several reports from both forms (based on whatever number is showing on the form). I am having trouble telling my query that I want it to choose the field from the current form, not the specific form. In other words, instead of [forms].[formname].[ID#], I would like to have it look at whatever form is open. Is this possible?


  2. #2
    Join Date
    Sep 2001
    Chicago, Illinois, USA
    There are several ways to do this.

    One way is to reference the active form, which is given in the Screen Object.


    Dim frmCurrentForm As Form
    Set frmCurrentForm = Screen.ActiveForm


    You could wrap this code in a function and us it as a criteria for the recordsource of the report.

    Another way, the DoCmd.OpenReport statement has a WHERE clause on it, which is essentially a criteria which gets applied to the recordsource of the report.

Posting Permissions

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