Create graph for database table

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.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
humbk2002Author Commented:
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
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
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.