Solved

Access 97 Chart's RowSource

Posted on 1998-08-31
3
347 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
  • 2
3 Comments
 
LVL 9

Accepted Solution

by:
perove earned 100 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access 2016 Debugging 7 42
Search Form with Run Time Error 3075 1 22
Web based Access Database and licencing 5 29
VBA code won't run Delete Query 5 17
When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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 …

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now