Access/MS Graph Question...


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Access/MS Graph Question...

Hybrid View

  1. #1
    Join Date
    Jun 2004
    Location
    Kalamazoo
    Posts
    15

    Access/MS Graph Question...

    I am encountering a few problems with MS Graph through Access VBA. Any help would be appreciated.

    1) The graph variables do not update fast enough to pull out the data to update the graph during creation at runtime (For instance: I would like to reset the CrossesAt to the MinimumScale value so that my Axis labels are in the correct place when the value drops below zero. Also, I would like to be able to read the SeriesCollection.Count value.).

    What ends up happening is that the default variables from the stored graph in the form are read instead of the new information from the query creating the graph. Once the graph has been opened the data is read correctly though (tested by adding a command button to the form and spitting out a message box with the information.) I need to be able to do this during creation at runtime.

    Is there any way to fix this? I've tried:

    Form("").OLEObject.Requery
    Form("").OLEObject.Object.Application.Chart.Update
    Form("").OLEObject.Object.Application.Chart.Requery

    None of these have worked.

    2) Is there any way to read Text information from the Legend or Series Collections? I want to change the color of the lines in my bar graph depending on the name of the series (For instance: I would like to change the color of my lines and points to red for the series named "TOTAL".).

    I have tried using typical terms like Caption, Text, Value, and Name with each of the items but these are not recognized.
    (Ex: Forms("").OLEObject.Object.Application.Chart.SeriesCollection.____
    or ...Chart.SeriesCollection(1).____
    or ...SerriesCollection(1).Series.____
    or ...Chart.Legend.LegenEntries(1).____ etc...)


    Thanks.
    Last edited by merlicky; 03-15-2006 at 01:11 PM.

  2. #2
    Join Date
    Jun 2004
    Location
    Kalamazoo
    Posts
    15
    Okay. I've solved all my problems. If anyone wants to know, I can post what I figured out.

  3. #3
    Join Date
    Apr 2006
    Posts
    1

    Access graph problem

    Please post your solution for problem #1. That would help me out greatly! I've been trying to solve this problem for years. I have a client who runs reports bi-annually and every once in a while a graph will display the values that were set at design-time. Very frustrating...
    Last edited by cyburt; 04-25-2006 at 02:51 PM.

  4. #4
    Join Date
    May 2006
    Posts
    1
    If you are still checking this thread, I would love the answer to question 2.
    Thanks.

  5. #5
    Join Date
    Jun 2004
    Location
    Kalamazoo
    Posts
    15
    For number 1, I added code to the OLEObjectís Updated event instead of running it as the form loads. That way it is ran AFTER the graph is updated with the new RowSource query. The Updated code is triggered when the Chartís RowSource is set through the code that calls the form.

    Since I wanted this to run only once and not keep looping with every change, I used the object's Tag to determine whether the code had already been run. Before I updated the Chartís RowSource I set the Tag to False. In my Updated sub I had an IF statement run if the Tag = False. Inside the IF statement I set the Tag = True.

    For number 2, there are a number of different variables that need to be used. I first set these object variables:

    Set OLEObj = Me.OLEGraph.Object 'Accesses the OLE object
    Set DataObj = OLEObj.Application.DataSheet 'Accesses the Datasheet of the OLE object
    Set ChartObj = OLEObj.Application.Chart 'Accesses the Chart of the OLE object

    Others references:

    OLEObj.SeriesCollection.Count 'Determines the number of items graphed/items in legend
    ChartObj.Legend.LegendEntries(<EnteryNumber>).LegendKey.Border.Color = "255" 'Sets the line color/border color for item
    ChartObj.Legend.LegendEntries(<EnteryNumber>).LegendKey.MarkerBackgroundColor = "190" 'Sets color for Marker background
    ChartObj.Legend.LegendEntries(<EnteryNumber>).LegendKey.MarkerForegroundColor = "190" 'Sets color for Marker foreground
    DataObj.Cells(<Row>, <Column>) 'Like with Excel, this reads/writes to this position in the datasheet

    With these variables I could loop through data in the data sheet and find the information that I wanted to change. Then knowing the Cell location of the data, I could manipulate the LegendEntryís Colors for that entry value.

Similar Threads

  1. Adjacency list representation of a graph
    By ThePrise in forum Java
    Replies: 4
    Last Post: 11-23-2005, 01:53 PM
  2. Display one record at a time!
    By ASP learner in forum ASP.NET
    Replies: 5
    Last Post: 10-08-2002, 07:17 PM
  3. question on best programming option
    By James in forum .NET
    Replies: 2
    Last Post: 03-28-2002, 07:14 AM
  4. VB,STORED PROC, COM, DTC QUESTION?
    By melvin ng in forum VB Classic
    Replies: 1
    Last Post: 11-10-2000, 03:46 AM
  5. Performance question
    By John in forum VB Classic
    Replies: 2
    Last Post: 04-05-2000, 09:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center