[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Access 97 Chart's RowSource

Posted on 1998-08-31
3
Medium Priority
?
354 Views
Last Modified: 2008-02-01
I have a string variable that I need to set as the RowSource of a chart.  How can I do that using VB code in Access?  I've tried   gphProduct.RowSource = str_select and I get an error message.  Any thoughts?
0
Comment
Question by:Magna
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
perove earned 200 total points
ID: 1960877
If this is on a report it cannot be done.
(cant chang graph's row source runtime..)
Is it on a report? I got a workaround if it is..let me know

if it is on a form you can do this:
on the form_open:
 
SQL = "SELECT DISTINCTROW [ko_navn],  blah blah blah"
Me![Field30].RowSource = SQL
Me.Refresh

This works for me, what is the error you gets..?

perove



0
 

Author Comment

by:Magna
ID: 1960878
The chart is on a report.  Can you send me the work-around?  The error message was something to the extent of - You entered an invalid expression for the RowSource of gphProduct or gphProduct does not except the property RowSource -  or something like that.  I have the exact message at work and I am  at home now.
0
 
LVL 9

Expert Comment

by:perove
ID: 1960879
Magna,
Yeah that make sense. I've belied I've read somwhere that you cannot change rowsource on a report runtime.
The workaround is simple it is to instead change the query. So Say you have a report where the graph has rowsource MyStandartGraphQuery

Waht we have to do is to change MyStandartGraphQuery to the real Query:

Here is a sub that changes queries:
Private Sub NK_SkiftQDef(FraQ As String)
'Funksjon that copies a query to MyStandartGraphQuery
 
DoCmd.SetWarnings False
    DoCmd.CopyObject , "MyStandartGraphQuery", A_QUERY, FraQ
DoCmd.SetWarnings True
End Sub


So you must link tha graph to a "standard" query, and before you open the report use this function to copy the query.
If the row source comes from a "user defined" SQL you have to open the query as a querydef, and change it's SQL.
The beuty of this method (it's my own idea actually) is that you can use it in runtime as weel as in MDE.

perove
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question