Dim r As Recordset
    Dim arrValues(1 To 12, 1 To 3)
    Dim i, j As Integer
    Dim sql$
    Set dat = OpenDatabase(App.Path & "XXX.mdb")
    
    MSChart1.Visible = True
    For i = 1 To 12
       arrValues(i, 1) = i & " "
       arrValues(i, 2) = 0  ' Series 1 values.
       arrValues(i, 3) = 0  ' Series 2 values.
    Next i
    
    Set r = dat.OpenRecordset(sql)
    
    Do While Not r.EOF
        i = Format(r!rq, "M")
        
            If Trim(r!jd) = "借" Then
                arrValues(i, 3) = arrValues(i, 3) + r!tot / 10000
            Else
                arrValues(i, 2) = arrValues(i, 2) + r!tot / 10000
            End If
        r.MoveNext
    Loop
    r.Close
    
    MSChart1.ChartData = arrValues
    ''''''''''''判断
        If Option2(0).Value Then
            If Option1(0).Value Then
                MSChart1.chartType = VtChChartType2dBar
            ElseIf Option1(1) Then
                MSChart1.chartType = VtChChartType2dLine
            ElseIf Option1(2) Then
                MSChart1.chartType = VtChChartType2dPie
            ElseIf Option1(3) Then
                MSChart1.chartType = VtChChartType2dArea
            ElseIf Option1(4) Then
                MSChart1.chartType = VtChChartType2dStep
            ElseIf Option1(5) Then
                MSChart1.chartType = VtChChartType2dXY
            End If
        ElseIf Option2(1).Value Then
            If Option1(0).Value Then
                MSChart1.chartType = VtChChartType3dBar
            ElseIf Option1(1) Then
                MSChart1.chartType = VtChChartType3dLine
            ElseIf Option1(3) Then
                MSChart1.chartType = VtChChartType3dArea
            ElseIf Option1(4) Then
                MSChart1.chartType = VtChChartType3dStep
            End If
        End If
    '0(柱形)   VtChChartType3dBar         8  VtChChartType3dCombination
    '1         VtChChartType2dBar         9  VtChChartType2dCombination
    '2(折线)   VtChChartType3dLine
    '3         VtChChartType2dLine
    '4(面积)   VtChChartType3dArea
    '5         VtChChartType2dArea
    '6(曲面)   VtChChartType3dStep
    '7         VtChChartType2dStep
    '14(饼图)  VtChChartType2dPie
    '16(散点)  VtChChartType2dXY
    '标题
        MSChart1.Title.Text = Trim(Text1)
    Else
        MSChart1.Title.Text = ""
    End If
    MSChart1.Refresh