📄 form1.frm
字号:
VERSION 5.00
Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
Begin VB.Form Form1
Caption = "筛选数据"
ClientHeight = 5070
ClientLeft = 60
ClientTop = 345
ClientWidth = 6120
LinkTopic = "Form1"
ScaleHeight = 5070
ScaleWidth = 6120
StartUpPosition = 3 '窗口缺省
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form1.frx":0000
Left = 360
List = "Form1.frx":000D
TabIndex = 7
Text = "姓名"
Top = 2520
Width = 1215
End
Begin VB.OptionButton Option1
Caption = "like"
Height = 255
Index = 1
Left = 2760
TabIndex = 6
Top = 2520
Width = 975
End
Begin VB.OptionButton Option1
Caption = "="
Height = 255
Index = 0
Left = 1800
TabIndex = 5
Top = 2520
Value = -1 'True
Width = 735
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 360
TabIndex = 4
Top = 3600
Width = 1215
End
Begin VB.TextBox Text1
Height = 270
Left = 3840
TabIndex = 3
Text = "照猫画虎"
Top = 2520
Width = 1575
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form1.frx":0023
Left = 1440
List = "Form1.frx":0030
TabIndex = 1
Text = "姓名"
Top = 3000
Width = 1215
End
Begin MSDBGrid.DBGrid DBGrid1
Bindings = "Form1.frx":0046
Height = 2055
Left = 240
OleObjectBlob = "Form1.frx":005A
TabIndex = 0
Top = 120
Width = 5655
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 375
Left = 1920
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 3600
Visible = 0 'False
Width = 2535
End
Begin VB.Label Label1
Caption = "排序字段"
Height = 255
Left = 360
TabIndex = 2
Top = 3000
Width = 855
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim sql As String
Private Sub Command1_Click()
strsql = sql + " where " + Combo2.Text
If Option1(0).Value = 1 Then
strsql = strsql + " = '"
strsql = strsql + Text1.Text + "'"
Else
strsql = strsql + " like '*"
strsql = strsql + Text1.Text + "*'"
End If
strsql = strsql + " order by " + Combo1.Text
Data1.RecordSource = strsql
Data1.Refresh
End Sub
Private Sub Form_Load()
DBGrid1.HeadLines = 1.3
Data1.DatabaseName = App.Path + "\zmhh.mdb"
sql = "select 姓名,地址,电话 From 名片"
Data1.RecordSource = sql
Data1.Refresh
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -