📄 find.frm
字号:
End
Begin VB.ComboBox Combo2
Height = 300
Index = 3
ItemData = "fin.frx":013A
Left = 1680
List = "fin.frx":0144
TabIndex = 4
Text = "并且"
Top = 2160
Width = 855
End
Begin VB.CommandButton cmdPrevious
Caption = "下一页"
Height = 375
Left = 7560
TabIndex = 3
Top = 2040
Width = 1095
End
Begin VB.CommandButton cmdNext
Caption = "上一页"
Height = 375
Left = 9960
TabIndex = 2
Top = 2040
Width = 1095
End
Begin VB.TextBox Text1
Alignment = 2 'Center
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 8880
TabIndex = 1
Text = "Text1"
Top = 2040
Width = 735
End
Begin VB.Label Label1
Caption = "为"
Height = 255
Index = 0
Left = 5280
TabIndex = 27
Top = 480
Width = 375
End
Begin VB.Label Label1
Caption = "为"
Height = 255
Index = 1
Left = 5280
TabIndex = 26
Top = 1080
Width = 375
End
Begin VB.Label Label1
Caption = "为"
Height = 255
Index = 2
Left = 5280
TabIndex = 25
Top = 1680
Width = 375
End
Begin VB.Label Label1
Caption = "为"
Height = 255
Index = 3
Left = 5280
TabIndex = 24
Top = 2280
Width = 375
End
Begin VB.Label Label2
Alignment = 2 'Center
Caption = "总数记录"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 8760
TabIndex = 23
Top = 840
Width = 1095
End
Begin VB.Label 总数
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 9960
TabIndex = 22
Top = 840
Width = 1875
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "查询结果"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 8760
TabIndex = 21
Top = 1440
Width = 1095
End
Begin VB.Label 查询
Alignment = 2 'Center
BorderStyle = 1 'Fixed Single
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 9960
TabIndex = 20
Top = 1440
Width = 1875
End
End
End
Attribute VB_Name = "findForm"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As ADODB.Recordset
Dim lsRS As ADODB.Recordset
Dim diyAndOr1 As String
Dim diyAndOr2 As String
Dim diyAndOr3 As String
Dim lCurrentPage As Long
Dim lPageCount As Long
Dim nPageSize As Integer
Dim lCount As Long
Private Sub Form_Load()
Set rs = New ADODB.Recordset '新建一个recordset
Set lsRS = New ADODB.Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseClient
rs.LockType = adLockPessimistic
rs.Open "SELECT * FROM 客户管理 ORDER BY 姓名 ASC", Con
lsRS.CursorType = adOpenStatic
lsRS.CursorLocation = adUseClient
lsRS.LockType = adLockPessimistic
lsRS.Open "SELECT * FROM ls客户管理", Con
Set 客户管理.客户Grid.DataSource = rs
总数.Caption = rs.RecordCount
Text2(20).Text = ""
Text2(21).Text = ""
Text2(22).Text = ""
Text2(23).Text = ""
now_add = True
now_find = True
Text2(20).Locked = False
Text2(21).Locked = False
Text2(22).Locked = False
Text2(23).Locked = False
Text2(20).Text = ""
Text2(21).Text = ""
Text2(22).Text = ""
Text2(23).Text = ""
End Sub
Private Sub Command1_Click()
If Check1(0).Value = 1 Then
rs.Filter = "" & Trim(Combo1(0).Text) & " LIKE ( '*" & Trim(Text2(20).Text) & "*')"
If Check1(1).Value = 1 Then
If Combo2(1).Text = "并且" Then
diyAndOr1 = "and"
ElseIf Combo2(1).Text = "或者" Then
diyAndOr1 = "or"
End If
rs.Filter = rs.Filter + " " & Trim(diyAndOr1) & " " & Trim(Combo1(1).Text) & " LIKE ( '*" & Trim(Text2(21).Text) & "*')"
If Check1(2).Value = 1 Then
If Combo2(2).Text = "并且" Then
diyAndOr2 = "and"
ElseIf Combo2(2).Text = "或者" Then
diyAndOr2 = "or"
End If
rs.Filter = rs.Filter + " " & Trim(diyAndOr2) & " " & Trim(Combo1(2).Text) & " LIKE ( '*" & Trim(Text2(22).Text) & "*')"
If Check1(3).Value = 1 Then
If Combo2(3).Text = "并且" Then
diyAndOr3 = "and"
ElseIf Combo2(3).Text = "或者" Then
diyAndOr3 = "or"
End If
rs.Filter = rs.Filter + " " & Trim(diyAndOr3) & " " & Trim(Combo1(3).Text) & " LIKE ( '*" & Trim(Text2(23).Text) & "*')"
End If
End If
End If
If rs.EOF Then
MsgBox ("无所需查找的资料")
Me.Hide
Unload 客户管理
Load 客户管理
客户管理.Show
Exit Sub
End If
查询.Caption = rs.RecordCount
Do While lsRS.EOF = False
lsRS.Delete
lsRS.MoveNext
Loop
Do While rs.EOF = False
lsRS.AddNew
For i = 0 To 21
lsRS.Fields(i) = rs.Fields(i)
Next
lsRS.Update
rs.MoveNext
Loop
rs.MoveFirst
End If
now_find = Not now_find
Exit Sub
End Sub
Private Sub Form_Unload(Cancel As Integer)
客户管理.Show
Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -