Solved

Access 97 Chart's RowSource

Posted on 1998-08-31
3
350 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 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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Familiarize people with the process of utilizing SQL Server views 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 Access…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

749 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