📄 frmqxjlb.frm
字号:
Caption = "开始时间"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 2040
TabIndex = 16
Top = 360
Width = 975
End
Begin VB.Label Label3
Caption = "名称"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 6
Top = 4920
Width = 495
End
Begin VB.Label Label2
Caption = "设备"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 3
Top = 2640
Width = 495
End
Begin VB.Label Label1
Caption = "厂站"
BeginProperty Font
Name = "楷体_GB2312"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 255
Left = 120
TabIndex = 0
Top = 360
Width = 495
End
End
Attribute VB_Name = "frmqxjlb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql1 As String
Dim sql2 As String
Dim sql3 As String
Dim sql4 As String
Dim RS As ADODB.Recordset
Private Sub Check1_Click()
If Check1.Value Then
sql1 = "select * from xdgl_qxjlb where fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check2.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check3.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and sbmc='" & Trim(List3.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
End If
End If
End If
Adodc1.RecordSource = sql1
Adodc1.Refresh
DataGrid1.Refresh
Call sx
End Sub
Private Sub Check2_Click()
If Check1.Value Then
sql1 = "select * from xdgl_qxjlb"
Else
If Check2.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "'"
Else
If Check3.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "'"
Else
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and sbmc='" & Trim(List3.Text) & "'"
End If
End If
End If
Adodc1.RecordSource = sql1
Adodc1.Refresh
DataGrid1.Refresh
Call sx
End Sub
Private Sub Check3_Click()
If Check1.Value Then
sql1 = "select * from xdgl_qxjlb where fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check2.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check3.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and sbmc='" & Trim(List3.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
End If
End If
End If
Adodc1.RecordSource = sql1
Adodc1.Refresh
DataGrid1.Refresh
Call sx
End Sub
Private Sub command1_Click(Index As Integer)
If Trim(List3.Text) <> "" Then
Else
A = MsgBox("设备编号不能为空", vbYesNo)
Exit Sub
End If
sql3 = "select max(id) from xdgl_qxjlb"
Call Open_link
Set RS = ZHCX.Execute(sql3, 0)
If IsNull(RS(0)) Then
ID = 1
Else
ID = RS(0) + 1
End If
If RS.State Then
RS.Close
End If
Adodc1.Recordset.AddNew
DataGrid1.Columns(0).Value = ID
DataGrid1.Columns(1).Value = Format(DTPicker1.Value, "yyyy-mm-dd") + " " + Format(Now, "hh:mm")
DataGrid1.Columns(2).Value = Trim(List1.Text)
DataGrid1.Columns(3).Value = Trim(List2.Text)
DataGrid1.Columns(4).Value = Trim(List3.Text)
DataGrid1.Columns(10).Value = Format(DTPicker1.Value, "yyyy-mm-dd") + " " + Format(Now, "hh:mm")
Adodc1.Recordset.Update
Adodc1.Refresh
DataGrid1.Refresh
Call Close_link
Call sx
End Sub
Private Sub Command2_Click(Index As Integer)
A = MsgBox("确认删除该记录吗?", vbYesNo)
If A = 6 Then
If Not Adodc1.Recordset.EOF Then
Adodc1.Recordset.Delete
Else
Exit Sub
End If
End If
Adodc1.Recordset.Update
Adodc1.Refresh
DataGrid1.Refresh
Call sx
End Sub
Private Sub Command3_Click(Index As Integer)
If Check1.Value Then
sql1 = "select * from xdgl_qxjlb where fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check2.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "'and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
If Check3.Value Then
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' order by fssj"
Else
sql1 = "select * from xdgl_qxjlb where dwmc='" & Trim(List1.Text) & "' and sbxl='" & Trim(List2.Text) & "' and fssj BETWEEN '" & DTPicker1.Value & "' and '" & DTPicker2.Value & "' and sbmc='" & Trim(List3.Text) & "' order by fssj"
End If
End If
End If
Debug.Print sql1
Adodc1.RecordSource = sql1
Adodc1.Refresh
Call sx
End Sub
Private Sub Command4_Click(Index As Integer)
End Sub
Private Sub Command5_Click(Index As Integer)
Dim sendexcel As Excel.Application
Set sendexcel = CreateObject("excel.Application")
sendexcel.Visible = True
sendexcel.Workbooks.Add
sql1 = Adodc1.RecordSource
Call Open_link
Set RS = ZHCX.Execute(sql1, 0)
If RS.EOF Then
Else
sendexcel.Cells(1, 1).Value = "设备缺陷记录"
sendexcel.Cells(1, 7).Value = "TY-SJ-178"
sendexcel.Cells(2, 1).Value = "发生时间"
sendexcel.Cells(2, 2).Value = "处理时间"
sendexcel.Cells(2, 3).Value = "单位名称"
sendexcel.Cells(2, 4).Value = "设备类型"
sendexcel.Cells(2, 5).Value = "设备名称"
sendexcel.Cells(2, 6).Value = "内容"
sendexcel.Cells(2, 7).Value = "备注"
sendexcel.Columns("A:A").ColumnWidth = 16
sendexcel.Columns("B:B").ColumnWidth = 16
sendexcel.Columns("C:C").ColumnWidth = 9
sendexcel.Columns("D:D").ColumnWidth = 9
sendexcel.Columns("E:E").ColumnWidth = 12
sendexcel.Columns("F:F").ColumnWidth = 16
sendexcel.Columns("G:G").ColumnWidth = 14
sendexcel.ActiveWindow.SmallScroll ToRight:=1
sendexcel.ActiveWindow.SmallScroll ToRight:=-1
sendexcel.Range("A2:G2").Select
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With sendexcel.Selection.Interior
.ColorIndex = 42
.Pattern = xlSolid
End With
sendexcel.Selection.Font.ColorIndex = 11
sendexcel.Selection.Font.Bold = True
sendexcel.Columns("A:G").Select
With sendexcel.Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
With sendexcel.Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Cells.Select
With sendexcel.Selection
.VerticalAlignment = xlBottom
.WrapText = True
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
sendexcel.Range("D5").Select
j = 3
Do While Not RS.EOF
If IsNull(RS(1)) Then
sendexcel.Cells(j, 1).Value = ""
Else
sendexcel.Cells(j, 1).Value = CStr(Trim(RS("fssj")))
End If
If IsNull(RS(3)) Then
sendexcel.Cells(j, 3).Value = ""
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -