Create graph for database table

Posted on 2002-04-04
Last Modified: 2012-06-21
I need a code that will be able to create a graph for the contents of database table maybe with the following fileds:ExpenseCategory and Amount,this graph should show the titile,the table fileds,and their figures also.I want different code for bar chart and a line chart.I have only 37 points available for a correct answer.Thus code has to basic,that is catering for extension of the table fields,whenever need arose.
Question by:humbk2002

Expert Comment

ID: 6918383
there is VB code for    GraphLite  (better than ms graph)
of course it is not full job but hope it helps

Accepted Solution

Bahnass earned 37 total points
ID: 6918393

Author Comment

ID: 6924791
My friend that code is not easy,it needs a lot of things.I have a code below,that generate a bar graph for items in a database query,this graph goes to a query and select two fields in that query and displays the information.This information is already stored in the database.This function is caled in a different  sub procedure,but it gives me a complie  error like this:

"Sub or funtion not defined"

 Public Function BarChartDraw()
 Dim numbExpenseCategory As Integer, maxExpensePayment As Single, i As Integer
 Dim lbl As String, lblwidth As Single, lblheight As Single
 Dim tickfactor As Single
 Set DB = OpenDatabase("Z:\Project\FinalProject(ExpensesMonitoringSystem).mdb")
Set RS = DB.OpenRecordset("qryExpenditure_transactions")
 numbExpenseCategory = 15
 maxExpensePayment = 0
Open "Z:\Project\FinalProject(ExpensesMonitoringSystem).mdb" For Input As DB
For i = 1 To numbExpenseCategory
Input #1, ExpenseCategory(i), Amount(i)
If ExpenseCategory(i) > maxExpensePayment Then
 maxExpensePayment = ExpenseCategory(i)
 End If
 Next i
 Screen.MousePointer = vbHourglass
 expGraph.Scale (-1, 1.2 * maxExpenseCategory)-(numbExpenseCategory + 1, -0.2 * maxExpensePayment)
 expGraph.Line (-1, 0)-(numbExpenseCategory + 1, 0)
 expGraph.Line (0, -0.1 * maxExpensePayment)-(0, 1.2 * maxExpensePayment)
 For i = 1 To maxExpenseCategory
 expGraph.Line (i - 0.2, Amount(i))-(i + 0.2, 0), , BF
 Next i
 expGraph.Line (i, ExpenseCategory(i))-(i + 1, ExpenseCategory(i + 1))
 End If
 expGraph.Circle (i, ExpenseCategory(i)), 0.01 * maxExpenseCategory
 Next i
 expGraph.CurrentX = -0.5
 expGraph.CurrentY = -0.1 * maxExpenseCategory
 expGraph.Print "Expense Categories "
 expGraph.CurrentX = 0.5
 expGraph.CurrentY = 1.2 * maxExpenseCategory
 expGraph.Print "Total Expenditure Transactions Made"
 For i = 1 To maxExpenseCategory
 lbl = Label(i)
 lblwidth = expGraph.TextWidth(lbl)
 tickfactor = 0.02 * maxExpenseCategory
 expGraph.Line (i, -tickfactor)-(i, tickfactor)
 expGraph.CurrentX = i - lblwidth / 2
 expGraph.CurrentY = -tickfactor
 expGraph.Print lbl
 Next i
 lbl = Str(maxExpenseCategory)
 lblwidth = expGraph.TextWidth(lbl)
 lblheight = expGraph.TextHeight(lbl)
 tickfactor = 0.02 * maxExpenseCategory
 expGraph.Line (-tickfactor, maxExpensePayment)-(tickfactor, maxExpensePayment)
 expGraph.CurrentX = -tickfactor - lblwidth
 expGraph.CurrentY = maxExpensePayment - lblheight / 2
 expGraph.Prit lbl
 End Function

Expert Comment

ID: 7017043
10 open questions, many are far below the minimum for easy questions of 50 points.  The maximum per question is 500 points.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101, Netminder or Mindphaser will return to finalize these if they are still open in 7 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.

*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link 
POINTS FOR EXPERTS awaiting comments are listed in the link below
Moderators will finalize this question if in @7 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
Thanks everyone.
Moderator @ Experts Exchange
LVL 49

Expert Comment

ID: 7642926
Hi humbk2002,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept Bahnass's comment(s) as an answer.

humbk2002, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB6 / DAO 3.6 / run time error: Couldn't find installable ISAM 7 94
Updates not working for MS Windows 7 12 166
Hide vba in gp 7 95
Send outlook email from VBS Script 2 30
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

810 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