📄 hisform.frm
字号:
Begin VB.CommandButton C6
Caption = "按关闭时刻"
Height = 465
Left = 4950
TabIndex = 30
Top = 1110
Width = 1245
End
Begin VB.CommandButton C2
Caption = "按阀门编号"
Height = 465
Left = 2610
TabIndex = 29
Top = 420
Width = 1245
End
End
End
Begin VB.Label Label18
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 13320
TabIndex = 28
Top = 390
Width = 2025
End
Begin VB.Label Label19
Alignment = 1 'Right Justify
BackStyle = 0 'Transparent
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 405
Left = 11340
TabIndex = 27
Top = 390
Width = 1845
End
Begin VB.Label Label12
BackStyle = 0 'Transparent
Caption = "节水灌溉智能监控系统"
BeginProperty Font
Name = "宋体"
Size = 26.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000080FF&
Height = 540
Left = 4320
TabIndex = 18
Top = 210
Width = 7545
End
End
Attribute VB_Name = "HisForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
On Error GoTo errhandler
Data1.DatabaseName = App.Path & "\data\dcf.mdb"
'Data1.DatabaseName = WinDir & "\" & "\system32\" & "dcf.mdb"
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 序号"
Data1.Refresh
Data1.Recordset.MoveLast
openfmn = Data1.Recordset.RecordCount '
Exit Sub
errhandler:
Call MsgBox("数据库文件不存在!", vbOKOnly, "警告!")
End Sub
Private Sub c1_Click()
choicenum = 1
Call recordsort
End Sub
Private Sub c2_Click()
choicenum = 2
Call recordsort
End Sub
Private Sub c3_Click()
choicenum = 3
Call recordsort
End Sub
Private Sub c4_Click()
choicenum = 4
Call recordsort
End Sub
Private Sub c5_Click()
choicenum = 5
Call recordsort
End Sub
Private Sub c6_Click()
choicenum = 6
Call recordsort
End Sub
Public Sub recordsort()
Dim bt As String
Dim datanum As Integer
On Error GoTo errhandler
If choicenum = 1 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 承包户名"
bt = "按承包户名顺序浏览历史记录("
End If
If choicenum = 2 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 阀门编号"
bt = "按阀门编号顺序浏览历史记录("
End If
If choicenum = 3 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 序号"
bt = "按打开时刻顺序浏览历史记录("
End If
If choicenum = 4 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 灌溉时间"
bt = "按灌溉时间顺序浏览历史记录("
End If
If choicenum = 5 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by RTU编号"
bt = "按RTU编号顺序浏览历史记录("
End If
If choicenum = 6 Then
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 序号"
bt = "按关闭时刻顺序浏览历史记录("
End If
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = bt + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
errhandler: Exit Sub
End Sub
Private Sub Command1_Click()
choicebz = 1
dingweiForm.Show vbModal
Call dnum
End Sub
Public Sub dnum()
On Error GoTo errhandler
Dim datanum As Integer
addtime(choicetype) = 0
If choicetype = "" Then
DBGrid1.Caption = choicetype + "号阀门" + "的统计表" + Str$(datanum) + "条" + ",累计灌溉时间" + Str$(addtime(choicetype)) + "分钟"
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE 阀门编号= " & choicetype & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
If datanum <> 0 Then
Data1.Recordset.MoveFirst
For i = 1 To datanum
addtime(choicetype) = addtime(choicetype) + Val(Text5.Text)
Data1.Recordset.MoveNext
Next i
End If
DBGrid1.Caption = choicetype + "号阀门" + "的统计表" + Str$(datanum) + "条" + ",累计灌溉时间" + Str$(addtime(choicetype)) + "分钟"
Data1.Recordset.MoveFirst
End If
errhandler:
Exit Sub
End Sub
Private Sub Command2_Click()
On Error GoTo errhandler
Dim datanum As Integer
choicebz = 2
dingweiForm.Show vbModal
If choicetype = "" Then
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE 打开时刻= " & Quote(choicetype) & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = "打开时刻[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
End If
errhandler:
DBGrid1.Caption = "打开时刻[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Exit Sub
End Sub
Private Sub Command3_Click()
On Error GoTo errhandler
Dim datanum As Integer
choicebz = 3
dingweiForm.Show vbModal
If choicetype = "" Then
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE 关闭时刻= " & Quote(choicetype) & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = "关闭时刻[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
End If
errhandler:
DBGrid1.Caption = "关闭时刻[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Exit Sub
End Sub
Private Sub Command4_Click()
On Error GoTo errhandler
Dim datanum As Integer
choicebz = 4
dingweiForm.Show vbModal
If choicetype = "" Then
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE 灌溉时间= " & choicetype & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = "灌溉时间=[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
End If
errhandler:
DBGrid1.Caption = "灌溉时间=[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Exit Sub
End Sub
Private Sub Command5_Click()
choicebz = 5
dingweiForm.Show vbModal
Call drtu
End Sub
Public Sub drtu()
On Error GoTo errhandler
Dim datanum As Integer
If choicetype = "" Then
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE RTU编号= " & choicetype & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = choicetype + "号RTU" + "的统计表(" + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
End If
errhandler:
DBGrid1.Caption = choicetype + "号RTU" + "的统计表(" + Str$(datanum) + "条)"
Exit Sub
End Sub
Private Sub Command6_Click()
choicebz = 6
dingweiForm.Show vbModal
Call dname
End Sub
Public Sub dname()
On Error GoTo errhandler
Dim datanum As Integer
If choicetype = "" Then
Exit Sub
Else
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 WHERE 承包户名= " & Quote(choicetype) & ""
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = "承包户[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Data1.Recordset.MoveFirst
End If
errhandler:
DBGrid1.Caption = "承包户[" + choicetype + "]的统计表(" + Str$(datanum) + "条)"
Exit Sub
End Sub
Public Sub his_data()
If HisForm.Data1.Recordset.RecordCount <> 0 Then
HisForm.Data1.Recordset.MoveLast
HisForm.Data1.Recordset.AddNew
End If
For i = 1 To num(hnum)
Text1.Text = filedata(hnum, i)
Text2.Text = infor(hnum, i)
Text3.Text = Date & " " & lgopentime(hnum)
Text4.Text = Date & " " & lgclosetime(hnum)
Text5.Text = lgsettime(hnum)
Text6.Text = fmname(hnum, i)
Text7.Text = fmID(hnum, i) + " " + fmaddr(hnum, i)
Text8.Text = fmID(hnum, i)
openfmn = openfmn + 1
Text9.Text = Str$(openfmn)
Data1.Recordset.AddNew
Next i
End Sub
Private Sub Cmdbz_Click()
TeamForm.Show
End Sub
Private Sub Cmdzt_Click()
filedForm.Show
End Sub
Private Sub Cmdxx_Click()
xxForm.Show
End Sub
Private Sub Cdata_Click()
Call get_cdata
End Sub
Public Sub get_cdata()
Dim datanum As Integer
bt = "按打开时刻顺序浏览历史记录("
Data1.RecordSource = "SELECT * FROM 电磁阀启闭记录表 order by 序号"
Data1.Refresh
Data1.Recordset.MoveLast
datanum = Data1.Recordset.RecordCount
DBGrid1.Caption = bt + Str$(datanum) + "条)"
'Data1.Recordset.MoveFirst
End Sub
Private Sub Cmdset_Click()
commandbz = 2
PassForm.Show
End Sub
Private Sub Cmdzn_Click()
GuideForm.Show
End Sub
Private Sub Cmdquit_Click()
commandbz = 3
PassForm.Show
End Sub
Private Sub Timer2_Timer()
Label19.Caption = Date
Label18.Caption = Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -