Solved

Create graph for database table

Posted on 2002-04-04
5
353 Views
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.
0
Comment
Question by:humbk2002
5 Comments
 
LVL 3

Expert Comment

by:Bahnass
ID: 6918383
try
www.vbsquare.com
there is VB code for    GraphLite  (better than ms graph)
of course it is not full job but hope it helps
0
 
LVL 3

Accepted Solution

by:
Bahnass earned 37 total points
ID: 6918393
0
 

Author Comment

by:humbk2002
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
 RS.Update
 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
0
 
LVL 1

Expert Comment

by:Moondancer
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.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

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.
http://www.experts-exchange.com/questions/Q.20283897.html
http://www.experts-exchange.com/questions/Q.20273817.html
http://www.experts-exchange.com/questions/Q.20274315.html
http://www.experts-exchange.com/questions/Q.20275778.html
http://www.experts-exchange.com/questions/Q.20277334.html
http://www.experts-exchange.com/questions/Q.20278207.html
http://www.experts-exchange.com/questions/Q.20281536.html
http://www.experts-exchange.com/questions/Q.20284857.html
http://www.experts-exchange.com/questions/Q.20285984.html
http://www.experts-exchange.com/questions/Q.20287484.html



*****  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
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
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.
Moondancer
Moderator @ Experts Exchange
0
 
LVL 49

Expert Comment

by:DanRollins
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
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

758 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now