📄 searchdataf3.frm
字号:
VERSION 5.00
Begin VB.Form SearchDataF3
BorderStyle = 3 'Fixed Dialog
Caption = "查找数据窗口"
ClientHeight = 4395
ClientLeft = 45
ClientTop = 330
ClientWidth = 7890
Icon = "SearchDataF3.frx":0000
KeyPreview = -1 'True
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4395
ScaleWidth = 7890
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.OptionButton Option2
Caption = "自定义"
Height = 255
Left = 1590
TabIndex = 9
Top = 3945
Width = 930
End
Begin VB.OptionButton Option1
Caption = "简单查询"
Height = 270
Left = 165
TabIndex = 8
Top = 3930
Value = -1 'True
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "取消(&C)"
Height = 330
Left = 6570
TabIndex = 5
Top = 3900
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定(&O)"
Height = 315
Left = 4860
TabIndex = 4
Top = 3915
Width = 990
End
Begin VB.Frame Frame2
Caption = "自定义查询"
Height = 2505
Left = 165
TabIndex = 3
Top = 1305
Width = 7545
Begin VB.TextBox Text4
Height = 285
Left = 4530
Locked = -1 'True
TabIndex = 21
Top = 465
Width = 585
End
Begin VB.ListBox List3
Height = 1860
Left = 3075
TabIndex = 20
Top = 495
Width = 1365
End
Begin VB.OptionButton Option6
Caption = "查找最后一个"
Height = 210
Left = 4680
TabIndex = 19
Top = 1965
Width = 2205
End
Begin VB.OptionButton Option5
Caption = "查找前一个"
Height = 195
Left = 4680
TabIndex = 18
Top = 1590
Width = 2100
End
Begin VB.OptionButton Option4
Caption = "查找下一个"
Height = 195
Left = 4665
TabIndex = 17
Top = 1230
Width = 2460
End
Begin VB.OptionButton Option3
Caption = "查找第一个"
Height = 210
Left = 4665
TabIndex = 16
Top = 945
Width = 2655
End
Begin VB.TextBox Text3
Height = 285
Left = 5070
TabIndex = 15
Top = 465
Width = 2355
End
Begin VB.ListBox List2
Height = 1860
Left = 1680
TabIndex = 13
Top = 465
Width = 1200
End
Begin VB.ListBox List1
Height = 1860
Left = 180
TabIndex = 10
Top = 480
Width = 1320
End
Begin VB.Label Label5
Caption = "表达式或值(&V)"
Height = 195
Left = 4695
TabIndex = 14
Top = 225
Width = 1650
End
Begin VB.Label Label4
Caption = "运算符(&O)"
Height = 180
Left = 3045
TabIndex = 12
Top = 225
Width = 1155
End
Begin VB.Label Label3
Caption = "查找项目(&F)"
Height = 165
Left = 390
TabIndex = 11
Top = 225
Width = 1395
End
End
Begin VB.Frame Frame1
Caption = "简单查询"
Height = 1140
Left = 165
TabIndex = 0
Top = 105
Width = 5100
Begin VB.TextBox Text2
Height = 285
Left = 1560
TabIndex = 1
Top = 675
Width = 3120
End
Begin VB.TextBox Text1
Height = 300
Left = 1545
TabIndex = 2
Top = 225
Width = 3105
End
Begin VB.Label Label2
Caption = "用户姓名: "
Height = 210
Left = 240
TabIndex = 7
Top = 720
Width = 1080
End
Begin VB.Label Label1
Caption = "用户代码:"
Height = 240
Left = 225
TabIndex = 6
Top = 330
Width = 1305
End
End
Begin VB.Image Image1
Height = 705
Left = 6135
Picture = "SearchDataF3.frx":08CA
Stretch = -1 'True
Top = 315
Width = 690
End
Begin VB.Shape Shape1
BorderColor = &H00808080&
Height = 4290
Index = 1
Left = 75
Top = 75
Width = 7755
End
Begin VB.Shape Shape1
BorderColor = &H00E0E0E0&
Height = 4290
Index = 0
Left = 45
Top = 45
Width = 7755
End
End
Attribute VB_Name = "SearchDataF3"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mbNotFound As Integer
Dim td As TableDef
Dim fld As Field
Dim ttd As TableDefs
Dim ffld As Fields
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
OpenMdb
Call PutWindowOnTop(Me)
i = 0
For Each td In NdMd.TableDefs
If i > 8 Then
List1.AddItem td.Name
End If
i = i + 1
Next td
List1.ListIndex = 0
List3.AddItem "等于" '"="
List3.AddItem "不等于" '"<>"
List3.AddItem "大于或等于" '">="
List3.AddItem "小于或等于" '"<="
List3.AddItem "大于" '">"
List3.AddItem "小于" '"<"
List3.AddItem "模糊" '"Like"
List3.ListIndex = 0
mbNotFound = False
End Sub
Private Sub List1_Click()
Dim i As Integer
Set ttd = NdMd.TableDefs
Set ffld = ttd(List1.Text).Fields
List2.Clear
For i = 0 To ffld.Count - 1
List2.AddItem ffld(i).Name
Next i
List2.ListIndex = 0
End Sub
Private Sub List3_Click()
Select Case List3.ListIndex
Case 0
Text4 = "="
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Case 1
Text4 = "<>"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
Case 2
Text4 = ">="
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
Case 3
Text4 = "<="
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
Case 4
Text4 = ">"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
Case 5
Text4 = "<"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
Case 6
Text4 = "Like"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3.SetFocus
End Select
End Sub
Private Sub Option1_Click()
If Option1 Then
Frame1.Enabled = True
Frame2.Enabled = False
Text1.SetFocus
End If
End Sub
Private Sub Option2_Click()
If Option2 Then
Frame2.Enabled = True
Frame1.Enabled = False
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Text1 <> "" Then
Select Case FrmIndex
Case 1
BrowseUser.Adodc1.Recordset.Find "[用户编码]='" & Trim(Text1.Text) & "'"
If BrowseUser.Adodc1.Recordset.eof = True Then
MsgBox "该用户未找到,请核实是否输入有误!", vbCritical
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Text1.SetFocus
Screen.MousePointer = 0
Exit Sub
End If
Case 2
'AmendUser.Adodc1.Recordset.Find "[用户编码]='" & Trim(Text1.Text) & "'"
'If AmendUser.Adodc1.Recordset.eof = True Then
' MsgBox "该用户未找到,请核实是否输入有误!", vbCritical
' Text1.SelStart = 0
' Text1.SelLength = Len(Text1)
' Text1.SetFocus
' Screen.MousePointer = 0
' Exit Sub
'End If
End Select
Unload SearchDataF3
Else
MsgBox "请输入数据!", vbInformation
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -