📄 form31.frm
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form Form31
BorderStyle = 0 'None
Caption = "Form31"
ClientHeight = 8010
ClientLeft = 0
ClientTop = 0
ClientWidth = 12165
Icon = "Form31.frx":0000
LinkTopic = "Form31"
Picture = "Form31.frx":1782
ScaleHeight = 8010
ScaleWidth = 12165
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer1
Interval = 64768
Left = 6720
Top = 6600
End
Begin VB.ComboBox Combo1
Appearance = 0 'Flat
Height = 300
Left = 960
TabIndex = 4
Top = 240
Width = 2175
End
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 300
Left = 6960
TabIndex = 3
Top = 240
Width = 2055
End
Begin VB.CommandButton Command1
Appearance = 0 'Flat
Caption = "查询"
Height = 300
Left = 9720
Picture = "Form31.frx":43D7
Style = 1 'Graphical
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.CommandButton Command2
Appearance = 0 'Flat
Caption = "取消"
Height = 300
Left = 11040
Picture = "Form31.frx":557B
Style = 1 'Graphical
TabIndex = 1
Top = 240
Width = 735
End
Begin VB.ComboBox Combo2
Appearance = 0 'Flat
Height = 300
Left = 4080
TabIndex = 0
Text = "Like"
Top = 240
Width = 1935
End
Begin MSComctlLib.ListView ListView1
Height = 6735
Left = 0
TabIndex = 9
Top = 840
Width = 12135
_ExtentX = 21405
_ExtentY = 11880
View = 3
LabelWrap = -1 'True
HideSelection = -1 'True
Checkboxes = -1 'True
FullRowSelect = -1 'True
GridLines = -1 'True
HotTracking = -1 'True
_Version = 393217
ForeColor = 0
BackColor = 16777215
BorderStyle = 1
Appearance = 0
NumItems = 5
BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Text = " 单位名称"
Object.Width = 5292
EndProperty
BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 1
Text = "工程编号"
Object.Width = 5292
EndProperty
BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 2
Text = "时间"
Object.Width = 3175
EndProperty
BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 3
Text = "共计"
Object.Width = 2999
EndProperty
BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628}
Alignment = 2
SubItemIndex = 4
Text = "作业组"
Object.Width = 4189
EndProperty
Picture = "Form31.frx":671F
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "项目:"
ForeColor = &H00FF0000&
Height = 255
Left = 360
TabIndex = 8
Top = 360
Width = 855
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "条件:"
ForeColor = &H00FF0000&
Height = 375
Left = 3480
TabIndex = 7
Top = 360
Width = 975
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "内容:"
ForeColor = &H00FF0000&
Height = 375
Left = 6360
TabIndex = 6
Top = 360
Width = 975
End
Begin VB.Label Label5
Appearance = 0 'Flat
BackColor = &H80000005&
BackStyle = 0 'Transparent
ForeColor = &H00FF0000&
Height = 375
Left = 0
TabIndex = 5
Top = 7680
Width = 11175
End
End
Attribute VB_Name = "Form31"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i, j, r As Integer
Dim sqlstring As String
Static l As Integer
If Combo1 = "" Or Combo2 = "" Or Text1 = "" Then
MsgBox "‘表达式不正确’", vbInformation, "提示框!"
Exit Sub
End If
Form31.ListView1.ListItems.Clear
sqlstring = "SELECT * FROM " & biaoming & " WHERE " & Combo1 & " " & Combo2 & " '%" & Text1 & "%'"
grs.Open sqlstring, gconn
l = 0
For i = 1 To grs.RecordCount
l = l + 1
Form31.ListView1.ListItems.Add i, , grs.Fields(0).Value
Form31.ListView1.ListItems.Item(i).SubItems(1) = grs.Fields(1).Value
Form31.ListView1.ListItems.Item(i).SubItems(2) = grs.Fields(2).Value
Form31.ListView1.ListItems.Item(i).SubItems(3) = grs.Fields(52).Value
Form31.ListView1.ListItems.Item(i).SubItems(4) = grs.Fields(53).Value
If grs.Fields(129).Value = "0" Then
Form31.ListView1.ListItems.Item(i).ForeColor = vbRed
For m = 1 To 4
Form31.ListView1.ListItems.Item(i).ListSubItems(m).ForeColor = vbRed
Next
End If
grs.MoveNext
Next
grs.Close
If l <> 0 Then
Form31.Label5.Caption = " 共有" & l & "记录满足查询条件"
Else
grs.CursorLocation = adUseClient
grs.Open "select * from " & biaoming & " order by 工程编号", gconn, adOpenKeyset, adLockPessimistic
For i = 1 To grs.RecordCount
l = l + 1
Form31.ListView1.ListItems.Add i, , grs.Fields(0).Value
Form31.ListView1.ListItems.Item(i).SubItems(1) = grs.Fields(1).Value
Form31.ListView1.ListItems.Item(i).SubItems(2) = grs.Fields(2).Value
Form31.ListView1.ListItems.Item(i).SubItems(3) = grs.Fields(52).Value
Form31.ListView1.ListItems.Item(i).SubItems(4) = grs.Fields(53).Value
If grs.Fields(129).Value = "0" Then
Form31.ListView1.ListItems.Item(i).ForeColor = vbRed
For m = 1 To 4
Form31.ListView1.ListItems.Item(i).ListSubItems(m).ForeColor = vbRed
Next
End If
grs.MoveNext
Next
grs.Close
MsgBox "没有查询的内容", vbInformation, "提示框!"
End If
For r = 1 To Form31.ListView1.ListItems.Count
Form31.ListView1.ListItems.Item(r).Checked = False
Next
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i, j, l, m As Integer
With Me
.Height = 8010
.left = 2332
.top = 2600
.Width = 12160
End With
With Combo2
.AddItem ("Like")
End With
Form31.ListView1.ListItems.Clear
grs.CursorLocation = adUseClient
grs.Open "select * from " & biaoming & " order by 工程编号", gconn, adOpenKeyset, adLockPessimistic
For j = 0 To 2
Form31.Combo1.AddItem (grs.Fields(j).Name)
Next j
For i = 1 To grs.RecordCount
k = k + 1
Form31.ListView1.ListItems.Add , , grs.Fields(0).Value
Form31.ListView1.ListItems.Item(i).SubItems(1) = grs.Fields(1).Value
Form31.ListView1.ListItems.Item(i).SubItems(2) = grs.Fields(2).Value
Form31.ListView1.ListItems.Item(i).SubItems(3) = grs.Fields(52).Value
Form31.ListView1.ListItems.Item(i).SubItems(4) = grs.Fields(53).Value
If grs.Fields(129).Value = "0" Then
Form31.ListView1.ListItems.Item(k).ForeColor = vbRed
For m = 1 To 4
Form31.ListView1.ListItems.Item(k).ListSubItems.Item(m).ForeColor = vbRed
Next
End If
grs.MoveNext
Next
grs.Close
If Form31.ListView1.ListItems.Count <> "0" Then
Form31.ListView1.ListItems(Form31.ListView1.ListItems.Count).Selected = True
Form31.ListView1.SelectedItem.EnsureVisible
Form31.ListView1.Refresh
End If
End Sub
Private Sub ListView1_DblClick()
Dim i, a, b, j, n, m, r As Integer
Dim p1, p2, p3 As Single
Static l As Integer
Dim a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20, a21, a22, a23, a24, a25, a26, a27, a28, a29, a30, a31, a32, a33, a34, a35, a36, a40, a41, a42, a43, a44, a45, a46, a47, a48, a49, a50, a51, a52, a53, a54, a55, a56, a57, a58, a59, a60, a61, a62, a63, a64, a65, a66, a67, a68, a69, a70, a81, a82, a83, a84, a85, a86, a87, a88, a89, a90, a91, a92, a93, a94, a95, a96, a97, a98, a99, a100, a101, a102, a103, a104, a105, a106, a107, a108, a109, a110, a121, a122, a123, a124, a125, a126, a127, a128, a129, a130, a131 As String
a = 0
b = 0
j = 0
For i = 1 To Form31.ListView1.ListItems.Count
If Form31.ListView1.ListItems.Item(i).Checked = True Then
m = m + 1
End If
Next
If m <> 1 Then
MsgBox "选择一条记录!", vbInformation, "提示"
Exit Sub
End If
For n = 1 To Form31.ListView1.ListItems.Count
If Form31.ListView1.ListItems.Item(n).Checked = True Then
grs.CursorLocation = adUseClient
grs.Open "select * from " & biaoming & " order by 工程编号", gconn, adOpenKeyset, adLockPessimistic
For j = 1 To grs.RecordCount
If grs.Fields(1).Value = Form31.ListView1.ListItems.Item(n).ListSubItems(1) Then
splc = Form31.ListView1.ListItems.Item(n).ListSubItems(1)
If grs.Fields(0) = 0 Then
a1 = ""
Else
a1 = grs.Fields(0)
End If
If grs.Fields(1) = 0 Then
a2 = ""
Else
a2 = grs.Fields(1)
End If
If grs.Fields(2) = 0 Then
a3 = ""
Else
a3 = grs.Fields(2)
End If
If grs.Fields(3) = 0 Then
a4 = ""
Else
a4 = grs.Fields(3)
End If
If grs.Fields(4) = 0 Then
a5 = ""
Else
a5 = grs.Fields(4)
End If
If grs.Fields(5) = 0 Then
a6 = ""
Else
a6 = grs.Fields(5)
End If
If grs.Fields(6) = 0 Then
a7 = ""
Else
a7 = grs.Fields(6)
End If
If grs.Fields(7) = 0 Then
a8 = ""
Else
a8 = grs.Fields(7)
End If
If grs.Fields(8) = 0 Then
a9 = ""
Else
a9 = grs.Fields(8)
End If
If grs.Fields(9) = 0 Then
a10 = ""
Else
a10 = grs.Fields(9)
End If
If grs.Fields(10) = 0 Then
a11 = ""
Else
a11 = grs.Fields(10)
End If
If grs.Fields(11) = 0 Then
a12 = ""
Else
a12 = grs.Fields(11)
End If
If grs.Fields(12) = 0 Then
a13 = ""
Else
a13 = grs.Fields(12)
End If
If grs.Fields(13) = 0 Then
a14 = ""
Else
a14 = grs.Fields(13)
End If
If grs.Fields(14) = 0 Then
a15 = ""
Else
a15 = grs.Fields(14)
End If
If grs.Fields(15) = 0 Then
a16 = ""
Else
a16 = grs.Fields(15)
End If
If grs.Fields(16) = 0 Then
a17 = ""
Else
a17 = grs.Fields(16)
End If
If grs.Fields(17) = 0 Then
a18 = ""
Else
a18 = grs.Fields(17)
End If
If grs.Fields(18) = 0 Then
a19 = ""
Else
a19 = grs.Fields(18)
End If
If grs.Fields(19) = 0 Then
a20 = ""
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -