Help for MS Chart Control 6.0, thanks a lot!

Joined
Jul 5, 2005
Messages
22
Reaction score
0
Help for MS Chart Control 6.0 & MS Graphy OLE, thanks a lot!

Hi guys,

i need to build statistical bar & pie chart based on defined query in code. some questions here,

Q1. if i define some depended queriese in code, "query12, query13", then i want to set the form's record source is query13, how to do that?

i code as, but not work
...
dim defQuery as String
dim query12, query 13 as QueryDef

query12.SQL= "select.....from students...."
query13.SQL= "select.....from query12......"

defQuery = CurrentDb.QueryDefs(query13).SQL

Me.RecordSource = query13

' i pass the defined query to ADO function to query the database, then get recordset object.
Call modADO.ConnectToThisDatabase
Call modADO.Students(modGlobal.curConn, modGlobal.rsRec, modGlobal.defQuery)
....



Q2. the query13 will output as below:

RANGE------------------PERCENT of TOTAL
0-5000---------------------0.3
5001-10000---------------0.1
10001-15000--------------0.2
null value-- ----------------0.4

I want to change 0.3 to 30%, how to do that in query13 or new query?
RANGE------------------PERCENT of TOTAL(%)
0-5000---------------------30%
5001-10000---------------10%
10001-15000--------------20%
null value-- ----------------40%





Q3. i paint charts by using MS Chart control 6.0 in this case and the chart is built OK based on a test query.
the problem is how to assign the percent value(30%, 10%...) on each column of in bar chart (0-4999, 5000-9999....)? in Pie chart? if not, is it possible to assign value to each corresponding legend in the chart?

i coded as below but not work:
...
With MSChart1 <-- bar chart
Set .DataSource = rsRec
.Visible = True
.ShowLegend = True
.Plot.Axis(VtChAxisIdY).AxisScale.Type = VtChScaleTypePercent
.Plot.Axis(VtChAxisIdY).AxisScale.PercentBasis = VtChPercentAxisBasisMaxChart
End With

With MSChart2 <- pie chart
Set .DataSource = rsRec
.Visible = True
.ShowLegend = True
End With
....

thanks a lot!

Peter




my student table is:

Student# -----------------City --------------------------Amount
> 1 -----------------------toronto -------------------------1000
> 2 -----------------------ottawa --------------------------3000
> 3 -----------------------toronto --------------------------4000
> 4 -----------------------ottawa --------------------------8000
> 5 -----------------------montreal ------------------------11000
> 6 -----------------------vancouver---------------------- 15000
> 7 -----------------------toronto
> 8 -----------------------ottawa
> 9 -----------------------montreal
> 10 -----------------------vancouver
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top