• Invalid reference to RowSource (Access 2000)

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Invalid reference to RowSource (Access 2000)

    Author
    Topic
    #359259

    Invalid reference to RowSource

    In a report called Sales by Category i have an embedded
    chart with the follwoing properties:
    OLE Class Microsoft Graph 97 Chart
    OLE Type embeded
    Class MSGraph.Chart.8
    Name SalesChart

    In the OnOpen event of the event i give the RowSource property
    of the chart called SalesChart with the following code:

    Reports![Sales by Category]![SalesChart].RowSource =
    “QrySalesbyCategory”

    However i receive the following error :

    You entered an expression that has an invalid reference to the
    property RowSource.

    What is most interesting, my function works with Forms but not
    with Reports.Can anyone help me? What I want is to use different

    Queries as the RowSource of my charts in Reports,but i cannot succeed.

    Viewing 1 reply thread
    Author
    Replies
    • #538056

      Try putting it in the OnLoad event instead and see if that helps. Some properties aren’t available in the Open event of a report. Is there a reason for setting this in code instead of just setting the row source of the graph object in its properties sheet?

      If moving it to the OnLoad event doesn’t work, think about coding the rowsource in properties. Here’s a rowsource I use for a graph in one of my apps to bring up a report with a chart for a specific month:

      SELECT qselLaborCost.ProjName, Sum(qselLaborCost.LaborHours) AS SumOfLaborHours FROM qselLaborCost WHERE (((Format([LWkBeginDt],”mmm”)) Like [Enter month as Mmm])) GROUP BY qselLaborCost.ProjName;

      There is no parameter in qselLaborCost, but this SQL statement has the same effect and is interactive with the user interface.

      Does that help?

      • #538059

        Thank you very much indeed for your kind and helpful reply.
        Best regards

    • #538238

      you can change the report in design mode and then open for preview as follows

          Dim stDocName As String
      
          stDocName = "ReportName"
         'open the thing in design mode.
          DoCmd.OpenReport stDocName, acViewDesign
          ' set the chart rowsource in design mode.
              Reports!ReportName!ChanrtName.RowSource = "QueryName"
          'save the changed report
          DoCmd.close acReport, stDocName, acSaveYes
          'open the thing as per normal.
          DoCmd.OpenReport stDocName, acPreview
      

      Altenately I believe that opening the report with a “where clause” or a saved query as a filter will also solve your problem assuming that the different queries are just variations on the original dataset.

    Viewing 1 reply thread
    Reply To: Invalid reference to RowSource (Access 2000)

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

    Your information: