Run-time error '3011' in Access2007

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fsunny
    New Member
    • Apr 2008
    • 1

    Run-time error '3011' in Access2007

    Hi, i hv a application running fine in Access97. After convert it to .accdb in Access2007, i print report and there's the error message "The MS Access database engine could not find the object "tblABC" , make sure the spelling is correct..." And the debug line show DoCmd.OpenRepor t "rptABC", acNormal, "tblABC"

    Can anyone tell me what's wrong in the syntax? The table tblABC do exist and no problem in Access97. Thanks!!
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Hi. The third parameter of the OpenReport method is intended to be a filter query. Your converted code does not have a query in the filter position, but the name of a table instead. If the report is meant to be filtered, I think you will have to provide a filter query as the third parameter instead of a table. It might be easier to do away with the filter query and supply a WHERE clause in the fourth parameter position instead.

    The MS help entry for the Openreport method is linked here.

    The following extract is from MS help on the use of filter queries:
    Using a Query as a Filter
    A separate query, sometimes called a filter query, can refer to the controls on your dialog box to get its criteria. Using this approach, you filter the records in a form or report by setting the filtername argument of the OpenForm or OpenReport method or action to the name of the filter query you create. The filter query must include all tables in the record source of the form or report you are opening. Additionally, the filter query must either include all the fields in the form or report you are opening, or you must set its OutputAllFields property to Yes.
    After you create and save the query to use as a filter, set the filtername argument of the OpenReport method or action to the name of the filter query. The filtername argument applies the specified filter query each time the OpenReport method runs.
    -Stewart

    Comment

    Working...