Results 1 to 2 of 2
  1. #1
    New Lounger
    Join Date
    Jan 2006
    Thanked 0 Times in 0 Posts

    Queries Referencing Form Text Boxes (2003)

    Hi, I tried to post this before, but I clicked on the post button before I finished.

    I am trying to run a query that references two text boxes on a form for the start date and the end date.

    Form Name: FrmMain
    Start Date Text Box Name: TxtMonthStart
    End Date Text Box Name: TxtMonthEnd

    I put into the criteria section in the date column "Between [forms]![FrmMain]![TxtMonthStart] and [forms]![FrmMain]![TxtMonthEnd]"

    My final queries are built off of other queries. I filter for the date in the first query. Then I built a crosstab query. Finally I run my final report query which is based off of the crosstab. The first query will return with no problem, but when I try to run the crosstab query or the final query it gives me the error message:

    "The Microsoft Jet engine does not recognize 'forms!FrmMain!TxtMonthStart' as a valid field name or expression."

    The only reason that I could think of is that the cross tab query is giving me the problem. I could filter for the dates after the crosstab query runs, but there is a lot of information and it would extend the time it takes to run these queries if the first two are running for years worth of data. Is there anything that I can do to have the crosstab query be able to run with the preceeding query being filtered on the dates in the text boxes on the form? I appreciate any help that you can give.

    Thank You,

    Bill Knecht

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Queries Referencing Form Text Boxes (2003)

    You have to tell Access explicitly what parameters you are using in a crosstab query:

    Open the crosstab query in design view.
    Select Query | Parameters.
    In the Parameter column, enter [forms]![FrmMain]![TxtMonthStart]
    In the Data Type column, select Date/Time.
    In the next row in the Parameter column, enter [forms]![FrmMain]![TxtMonthEnd]
    In the Data Type column, select Date/Time.
    Click OK.

Posting Permissions

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