我调试了,跟本不走代码那呀,到Private Sub Command1_Click()就over了,还是帖出吧: Private Sub Command1_Click() db1.RecordSource = "select count(distinct(车牌号)) from 年度2003行驶记录表" db1.Refresh If db1.Recordset.RecordCount < 1 Then Exit Sub i_ComputerCount = db1.Recordset.Fields("BarComputerCount")
' DbLogInfo.CommandType = adCmdText ' DbLogInfo.RecordSource = "select * from " & tablename & " where barno='" + s_barno + "' order by logdatetime" ' DbLogInfo.Refresh
i_BarCount = DbLogInfo.Recordset.RecordCount If i_BarCount = 0 Then Exit Sub PicDraw.Visible = False ChartMonth.Visible = False
Private Sub Command1_Click()
db1.RecordSource = "select count(distinct(车牌号)) from 年度2003行驶记录表"
db1.Refresh
If db1.Recordset.RecordCount < 1 Then Exit Sub
i_ComputerCount = db1.Recordset.Fields("BarComputerCount")
' DbLogInfo.CommandType = adCmdText
' DbLogInfo.RecordSource = "select * from " & tablename & " where barno='" + s_barno + "' order by logdatetime"
' DbLogInfo.Refresh
i_BarCount = DbLogInfo.Recordset.RecordCount
If i_BarCount = 0 Then Exit Sub
PicDraw.Visible = False
ChartMonth.Visible = False
RowStep = CInt(i_ComputerCount \ 20) + 1
ColStep = 1
Call DrawGrid(i_ComputerCount, 31)
DbLogInfo.Recordset.MoveFirst
i_count = 0
DbLogInfo.RecordSource = "select sum(thecomputercount),min(logdatetime),max(logdatetime) from " & tablename & " where barno='" + s_barno + "' and logdatetime like '" & TxtYearInMonth.Text & "-" & Right("00" & ComMonth.Text, 2) & "%'"
DbLogInfo.Refresh
DbLogInfo.Recordset.MoveFirst
PicDraw.Visible = False
If Not IsNull(DbLogInfo.Recordset.Fields(0)) And Not IsNull(DbLogInfo.Recordset.Fields(1)) And Not IsNull(DbLogInfo.Recordset.Fields(2)) Then
If CInt(DbLogInfo.Recordset.Fields(0)) > 0 Then
s_DTstart = Left(DbLogInfo.Recordset.Fields(1), 7) & "-01 00:00:00"
s_DTEnd = Left(DbLogInfo.Recordset.Fields(1), 7) & "-02 00:00:00"
s_DtEndTime = Left(DbLogInfo.Recordset.Fields(2), 10) & " 23:59:59"
While CDate(s_DTstart) <= CDate(s_DtEndTime)
DbLogInfo.RecordSource = "select sum(thecomputercount)/count(*) from " & tablename & " where barno='" + s_barno + "' and logdatetime>='" & s_DTstart & "' and logdatetime<'" & s_DTEnd & "'"
DbLogInfo.Refresh
i_TheComputerCount = 0
DbLogInfo.Recordset.MoveFirst
If Not IsNull(DbLogInfo.Recordset.Fields(0)) Then
i_TheComputerCount = DbLogInfo.Recordset.Fields(0)
End If
Call DrawYearOrMonthBar(i_TheComputerCount, i_ComputerCount, i_count)
ChartMonth.ColumnCount = i_count + 1
ChartMonth.Column = i_count + 1
ChartMonth.ColumnLabel = (i_count + 1) & "日"
ChartMonth.Data = i_TheComputerCount '/ i_ComputerCount
s_DTstart = s_DTEnd
s_DTEnd = CDate(s_DTEnd) + 1
s_DTEnd = Year(s_DTEnd) & "-" & Right("00" & Month(s_DTEnd), 2) & "-" & Right("00" & Day(s_DTEnd), 2) & " 00:00:00"
i_count = i_count + 1
Wend
ChartMonth.Row = 1
ChartMonth.RowLabel = CmbArea.Text & Trim(Left(CmbBarNo.Text, Len(CmbBarNo.Text) - 10)) & TxtYearInMonth.Text & "年" & ComMonth.Text & "月情况一览"
End If
End If
End If '判断是否存在查询月份的日志表 结束
End If
ChartMonth.Visible = True
End Sub
里面有个自定义的函数或者过程!你没有啊!
DrawGrid
还多了两个ENDIF