Using a Form to set criteria for a crosstab query

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gattkisson
    New Member
    • Jun 2010
    • 1

    Using a Form to set criteria for a crosstab query

    I am using Access 2002. I have created a query that has a crosstab query linked to it. The query runs fine initially. but I went back to add criteria to the query that is coming from a form and now I get the following error message as the query is running: "The Microsoft Jet database engine does not recognize [forms]![FormName]![fieldname] as a valid field name or expression.". If I remove the crosstab query link or save the crosstab data to a file and then link to the file the query runs fine using the form criteria. How can I get Jet engine to recognize the form fields? This only happens when using forms associated with crosstab queries.
  • ahmedtharwat19
    New Member
    • Feb 2007
    • 55

    #2
    TRY THIS:

    Code:
    Rem:DEFINE THE [B]CRITERIA[/B]
    Dim [B]stLinkCriteria [/B]As String
    [B]stLinkCriteria [/B]= "[banking] =" & "true"
    Rem:OPEN REPORT WITH [B]CRITERIA[/B]
    DoCmd.OpenReport "BankingReport", _
     acViewPreview, "", [B]stLinkCriteria[/B], acNormal
    BEST REGARDS ,

    AHMED THARWAT (MEDO)

    Comment

    Working...