Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Ad Hoc Charts in Access

Posted on 1998-08-14
3
Medium Priority
?
187 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
  • 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Suggested Courses

782 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