📄 frm电网异常情况统计.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frm电网异常情况统计
Caption = "调度月报 ----电网异常情况统计"
ClientHeight = 6585
ClientLeft = 60
ClientTop = 345
ClientWidth = 7035
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 6585
ScaleWidth = 7035
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3720
TabIndex = 7
Top = 0
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "删除"
Height = 375
Left = 3000
TabIndex = 6
Top = 480
Width = 855
End
Begin VB.CommandButton Command3
Caption = "统计电网异常情况"
Height = 375
Left = 720
TabIndex = 5
Top = 480
Width = 1695
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frm电网异常情况统计.frx":0000
Height = 5535
Left = 120
TabIndex = 4
Top = 840
Width = 6855
_ExtentX = 12091
_ExtentY = 9763
_Version = 393216
BackColor = 12648384
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.TextBox Text1
BackColor = &H80000000&
ForeColor = &H00800000&
Height = 1815
Left = 240
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 1
Top = 3480
Width = 6255
End
Begin VB.CommandButton Command2
Caption = "打印"
Height = 375
Left = 4320
TabIndex = 0
Top = 480
Width = 855
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 720
TabIndex = 2
Top = 0
Width = 1215
_ExtentX = 2143
_ExtentY = 661
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CustomFormat = "yyyy-MM"
Format = 61145091
UpDown = -1 'True
CurrentDate = 37917
End
Begin MSAdodcLib.Adodc Adodc1
Height = 855
Left = 2760
Top = 4080
Width = 1575
_ExtentX = 2778
_ExtentY = 1508
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.Label Label2
Caption = "制表人"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 8
Top = 0
Width = 1095
End
Begin VB.Label Label1
Caption = "月份"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 3
Top = 0
Width = 615
End
End
Attribute VB_Name = "frm电网异常情况统计"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
On Error Resume Next
If Not Adodc1.Recordset.EOF Then
'Adodc1.Recordset.Delete
A = MsgBox("是否删除该记录!", vbYesNo)
If A = 6 Then
Adodc1.Recordset.Delete
Else
Exit Sub
End If
Else
Exit Sub
End If
Adodc1.Refresh
DataGrid1.Refresh
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveLast
End If
Call sx
End Sub
Private Sub Command2_Click()
On Error Resume Next
Dim sendword As Word.Application
Set sendword = CreateObject("Word.Application")
sendword.Visible = True
sendword.Documents.Add
sendword.Selection.Font.Size = 12
temp = ""
Call Open_link
Sql = "SELECT * FROM XDGL_DDYB_DWYC WHERE RQ='" & DTPicker1.Value & "' order by xh"
Set RS = ZHCX.Execute(Sql, 1)
Do While Not RS.EOF
temp = temp + CStr(RS("XH")) + ". " + Format(RS("GZRQ"), "yyyy-mm-dd") + RS("NR") + Chr(10)
RS.MoveNext
Loop
If RS.State Then
RS.Close
End If
Call Close_link
Call Close_link
sendword.Selection.TypeText Text:=" " & Format(DTPicker1.Value, "yyyy年mm月") & "电网异常情况统计" + Chr(13) + Chr(10) + temp + " 制表人: " + Text2.Text + " 制表日期:" + Format(Now, "yyyy年mm月dd日")
End Sub
Private Sub Command3_Click()
On Error Resume Next
A = MsgBox("将删除原有的数据再从交接班中取相关数据!", vbYesNoCancel, "警告")
If A = 6 Then
Call Open_link
Sql = "select * from xdgl_jjbfb where jbrq between '" & DTPicker1.Value & "' and '" & DateAdd("d", -1, DateAdd("m", 1, DTPicker1.Value)) & "' and jllx='系统事故及异常'"
sql1 = "delete from xdgl_ddyb_DWYC where rq='" & DTPicker1.Value & "'"
Set RS = ZHCX.Execute(sql1, 1)
If RS.State Then
RS.Close
End If
Set RS = ZHCX.Execute(Sql, 1)
j = 1
Do While Not RS.EOF
Sql = "INSERT XDGL_DDYB_DWYC (RQ,XH,GZRQ,NR) VALUES ('" & DTPicker1.Value & "'," & j & ",'" & RS("JBRQ") & "','" & RS("JLNR") & "')"
Set RS1 = ZHCX.Execute(Sql, 1)
If RS1.State Then
RS1.Close
End If
j = j + 1
RS.MoveNext
Loop
If RS.State Then
RS.Close
End If
Call Close_link
End If
Adodc1.Refresh
Call sx
End Sub
Private Sub DTPicker1_Change()
Adodc1.RecordSource = "SELECT * from XDGL_DDYB_DWYC where rq='" & Format(DTPicker1.Value, "yyyy-mm-01") & "' order by xh"
Adodc1.Refresh
Call sx
End Sub
Private Sub Form_Load()
On Error Resume Next
Text2.Text = cname
DTPicker1.Value = Format(Now, "YYYY-MM-01")
Adodc1.ConnectionString = "PROVIDER=MSDASQL;dsn=ddmis;uid=mis;pwd=mis005;database=zhcx"
Adodc1.RecordSource = "select * from XDGL_DDYB_DWYC where rq='" & DTPicker1.Value & "' order by xh"
Adodc1.Refresh
Call DTPicker1_Change
End Sub
Sub sx()
DataGrid1.Columns(0).Visible = False
DataGrid1.Columns(1).Caption = "序号"
DataGrid1.Columns(2).Caption = "时间"
DataGrid1.Columns(3).Caption = " 内容"
DataGrid1.Columns(3).Width = 10000
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -