📄 frmsql.frm
字号:
VERSION 5.00
Begin VB.Form FrmSql
BorderStyle = 3 'Fixed Dialog
Caption = "查找"
ClientHeight = 1695
ClientLeft = 45
ClientTop = 330
ClientWidth = 4680
ControlBox = 0 'False
Icon = "FrmSql.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1695
ScaleWidth = 4680
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton CmdSql
Cancel = -1 'True
Caption = "取消(&C)"
Height = 315
Index = 1
Left = 3600
TabIndex = 5
Top = 1260
Width = 1035
End
Begin VB.CommandButton CmdSql
Caption = "确定(&Y)"
Default = -1 'True
Height = 315
Index = 0
Left = 2280
TabIndex = 4
Top = 1320
Width = 1035
End
Begin VB.Frame Frame1
Caption = "查找内容"
Height = 1035
Left = 60
TabIndex = 0
Top = 60
Width = 4575
Begin VB.TextBox TxtSQL
Height = 300
Left = 2040
TabIndex = 3
Top = 420
Width = 2295
End
Begin VB.ComboBox CboField
Height = 300
ItemData = "FrmSql.frx":000C
Left = 180
List = "FrmSql.frx":000E
Style = 2 'Dropdown List
TabIndex = 1
Top = 420
Width = 1455
End
Begin VB.Label Label1
Caption = "Like"
Height = 195
Left = 1680
TabIndex = 2
Top = 480
Width = 375
End
End
End
Attribute VB_Name = "FrmSql"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'强制变量声明
Option Explicit
'定于本模块用到的全局变量数据集对象rs
Public rs As ADODB.Recordset
'定义用于存储数据集对象rs中的字段数目intNumField
Public intNumField As Integer
'定义用于存储所设置的查询条件的全局变量strSqlField
Public strSqlField As String
Private Sub CmdSql_Click(Index As Integer)
'判断单击的命令按钮
Select Case Index
Case 0
'单击的是“确定”按钮,判断输入的查询条件是否为空
If Me.TxtSQL.Text = "" Then
'输入的查询条件为空,设置变量intNumField值为-1,
'表示为设置查询条件
intNumField = -1
Else
'输入的查询条件不为空,设置全局变量intNumField值
'为选择的ComboBox控件的值
intNumField = Me.CboField.ListIndex
'设置全局变量strSqlField值为设置的查询值
strSqlField = Me.TxtSQL.Text
End If
Case 1
'单击的是“取消”按钮,设置变量intNumField值为-2
intNumField = -2
End Select
Unload Me
End Sub
Private Sub Form_Load()
Dim intTmp As Integer
'利用ComboBox控件CboField的AddItem方法,依次将数据集对象rs中
'的各个字段名在本控件中显示出来,供用户选择
For intTmp = 0 To intNumField - 1
Me.CboField.AddItem rs.Fields(intTmp).Name
Next
'设置ComboBox控件CboField的当前位置为第一个列表项
Me.CboField.ListIndex = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -