Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ad Hoc Charts in Access

Posted on 1998-08-14
3
Medium Priority
?
185 Views
Last Modified: 2006-11-17
I'm supposed to generate reports and charts based on a variety of factors selected from a form. Kind of like a report/chart wizard. I think I can do the reports, but not the charts. Do I use MS Graph or the MSChart ActiveX control? Can it be generated/modified dynamically with VBA?
0
Comment
Question by:dwbrown
[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 17

Accepted Solution

by:
ramrom earned 300 total points
ID: 1959212
MS Graph is pretty versatile. If you have Office 97 Professional, there is a help file on the CD:\valupack\morehelp\vbagrp8.hlp. It isn't a vrey good help file. Here is some sample code I'm using to drive it (from FoxPro), but the translation to VBA is straightforward:

set gr = me!graph.graph.application '  where graph is the control name.
with gr
  with .datasheet ' holds the axis labels, legend and data
    .range("B:Z").delete   ' remove initial set of data
    .range("2:12").delete
  end with
  with .chart
    .charttype = xlBarClustered
    .hastitle = .t.
    with .charttitle
      .font.size = 12
      .font.bold = .f.
      .text = rpt_name + ' ' + dtoc(date()) + ' ' + sub_title
    end with
    .hastitle = .f.
    with .axes(2)
      .hastitle = .t.
      with .axistitle
        .font.size = 10
        .font.bold = .f.
        .orientation = 0
        .text = "% Proficient or Count"
      end with
      .maximumscale = 100
      .ticklabels.font.bold = .f.
      .ticklabels.font.size = 10
    end with
    if somecondition
      with .legend
        .font.size = 10
        .font.bold = .f.
      end with
    else
      .haslegend = .f.
    endif

Loading data (from an array) :

for ds_row = 2 to n_cols + 1
  gr.datasheet.cells(ds_row, ds_col) = graph_data(DataRow, ds_row - 1)
next j

Setting x axis label:
gr.datasheet.cells(1, ds_col) = "First Trail"

Setting legendl:
gr.datasheet.cells(2, 1) = "Boys"
gr.datasheet.cells(3, 1) = "Girls"

In FoxPro
  .t. = true
  .f. = false
  endif = end if
  if stmt does not have then

Hope this helps
0
 
LVL 17

Expert Comment

by:ramrom
ID: 1959213
BTW dtoc() is a FoxPro date to character conversion function.
0
 

Author Comment

by:dwbrown
ID: 1959214
thanks for your answer, before I accept it, which i will, I have an additional question or 3. I have tried just setting the HasTitle property, just to establish communication with the graph, via VBA, with no success. Have you done this in Access? I assume you put the control on a form or report first? Is this an ActiveX control? Maybe I need to re-register it. I can insert the control on a form but can't access it in code. thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
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.
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 …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

721 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