Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Invalid reference to RowSource (Access 2000)

    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.

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Invalid reference to RowSource (Access 2000)

    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?
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid reference to RowSource (Access 2000)

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

  4. #4
    2 Star Lounger
    Join Date
    Mar 2001
    Location
    Emerald Beach, New South Wales, Australia
    Posts
    126
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Invalid reference to RowSource (Access 2000)

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

    <pre> 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
    </pre>


    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.

  5. #5
    LinguaGo
    Guest

    Re: Invalid reference to RowSource (Access 2000)

    It has been my experience that you cannot change the RowSource of a control on a subReport and I believe that the embedded chart is probably considered the same as a subReport.
    You can change the RowSource of controls on a Report, a Form or subForm but not a subReport.

    I have come up against this problem in my language translation program where I have to switch the RowSource of a subReport control to use the appropriate language fields.

    The only solution that I have found to work is to use a "Callback" function whose name is given in the RowSourceType. It is the Callback function that uses the appropriate query to return the values to the ComboBox. In my case it returns the value in the appropriate language.

    In some cases where I did not want to use a Callback function and had only one report using a subreport that was only needed for 2 languages, I simply created 2 subReports and dynamically changed the RowSource in the main report to use one or the other; (reports don't have a problem, just subReports).

    ADDITIONNAL consideration for Access XP(2002).
    XP has a new quirck when it comes to the RowSource on a subForm only. It will accept the RowSource change but display with the caracteristics of the original value of the RowSource.
    Example: If the original value shows an english description and it is changed dynamically to a french description then the values will display in english but the drop down list will be in french. The workarround for this is not to put a RowSource value in the control (i.e. leave the RowSource empty). Then when you change the RowSource dynamically, it will work properly.
    This problem does not exist under Access 97 or 2000, it is an XP exclusive.

    Hope this helps.

    LinguaGo
    Internationalize your Access applications
    www.linguago.com

Posting Permissions

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