473,386 Members | 1,819 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

graph connect with micrsoft access

Hye...
I want to draw a graph which connected to data in microsoft access. How to do it, and what component should i include.
thnx..
Mar 15 '07 #1
2 1224
Killer42
8,435 Expert 8TB
Hye...
I want to draw a graph which connected to data in microsoft access. How to do it, and what component should i include.
That sounds like a job for the Microsoft Chart Control (which is what to look for in the component list).
Mar 15 '07 #2
Thnx for the reply... and here i want to share the codes with others.... simple graph...i like it

component needed... mschart
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. ' Be sure to set a reference to the Microsoft ActiveX Data
  3. ' Objects 2.0 Library.
  4. Private rsProducts As New ADODB.Recordset
  5. Private cn As New ADODB.Connection
  6.  
  7. Private Sub Form_Load()
  8.    Dim strQuery As String ' SQL query string.
  9.    Dim a As Integer
  10.    Dim b As String
  11.  
  12.    ' First change the path to a valid path for your machine.
  13.    cn.ConnectionString = _
  14.    "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=your database location;Persist Security Info=False"
  15.  
  16.    ' Open the connection.
  17.    cn.Open
  18.  
  19.    ' Create a query that retrieves only four fields.
  20.    strQuery = "SELECT Date, Sum from Query1"
  21.    ' Open the recordset.
  22.    rsProducts.Open strQuery, cn, adOpenKeyset
  23.    ' Set the DataSource to the recordset.
  24.    With MSChart1
  25.      .ShowLegend = True
  26.      Set .DataSource = rsProducts
  27.  
  28.      Dim X() As Variant
  29.  
  30.    End With
  31.  
  32.    If a > 0 Then
  33.         ReDim X(1 To a, 1 To 2)
  34.         Dim i As Integer
  35.         i = 1
  36.         While Not rsProducts.EOF
  37.             X(i, 1) = rsProducts("Date") 'Date field in Query1 
  38.             X(i, 2) = rsProducts("Sum") 'Sum field in Query1
  39.             i = i + 1
  40.             rsProducts.MoveNext
  41.         Wend
  42.         MSChart1.ChartData = X
  43.     End If
  44.  
  45. End Sub
Mar 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

25
by: Magnus Lie Hetland | last post by:
Is there any interest in a (hypothetical) standard graph API (with 'graph' meaning a network, consisting of nodes and edges)? Yes, we have the standard ways of implementing graphs through (e.g.)...
2
by: Jeff Blee | last post by:
I am hoping someone can help me. I am making a Access 97 app for a person and have run up against a problem to do with MS Graph. There is a table that has a number of data elements and a date field...
6
by: David W. Fenton | last post by:
Is MS Graph really completely useless in Access 97? I uninstalled and re-installed to get the Office 97 version of MS Graph, but I see no way whatsoever to insert dynamic data into the chart....
2
by: Zlatko | last post by:
I am dealing with very frustrating problem: I don't know how to pass parameters to the stored procedure which is row source of MS Graph in Access PROJECT form. The problem apears because there is...
2
by: MLH | last post by:
A97 Am having difficulty displaying graph in Form View that I see fine in graph control on form opened in design view. I know I'm doing something wrong. If I open the form in design view - I...
2
by: savas_karaduman | last post by:
I supposed that creating graph with access would be as easy as how I could with Excel. But it seems to me that there is some tricky point here. What i am trying to do and what i got is as follow: ...
3
by: Jawad Rehman | last post by:
Hello everybody..... I have an excel file which is resided on server,there is some data on the cells .Now i want to generate dynamic graph on the basis of the data present in the excel file ...
5
by: chrispoliquin | last post by:
I need to represent the hyperlinks between a large number of HTML files as a graph. My non-directed graph will have about 63,000 nodes and and probably close to 500,000 edges. I have looked...
3
by: The Frog | last post by:
Hi guys, I have never touched really on this area before with forms and reports, and now I would like to be able to incorporate some graphs / charts for a new little app I am building, and I...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.