?? 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 + -