?? select.frm
字號:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmSelect
Caption = "篩選數據"
ClientHeight = 2640
ClientLeft = 60
ClientTop = 345
ClientWidth = 5355
Icon = "select.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 5355
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Caption = "篩選條件"
Height = 1455
Left = 120
TabIndex = 9
Top = 1080
Width = 5175
Begin VB.OptionButton lblLike
Caption = "like"
Height = 255
Left = 2760
TabIndex = 17
Top = 360
Width = 750
End
Begin VB.OptionButton lblEqual
Caption = "="
Height = 255
Left = 1320
TabIndex = 16
Top = 360
Value = -1 'True
Width = 495
End
Begin VB.OptionButton lblSmall
Caption = "<"
Height = 255
Left = 1800
TabIndex = 13
Top = 360
Width = 495
End
Begin VB.TextBox txtCompare
Height = 270
Left = 3600
TabIndex = 12
Top = 360
Width = 1455
End
Begin VB.OptionButton lblLarge
Caption = ">"
Height = 255
Left = 2280
TabIndex = 11
Top = 360
Width = 495
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "select.frx":0442
Left = 120
List = "select.frx":045E
TabIndex = 10
Text = "職稱"
Top = 360
Width = 1095
End
Begin MSComctlLib.ImageList ImageList1
Left = 3840
Top = 720
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
ImageWidth = 32
ImageHeight = 32
MaskColor = 12632256
_Version = 393216
BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}
NumListImages = 1
BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}
Picture = "select.frx":049E
Key = ""
EndProperty
EndProperty
End
Begin MSComctlLib.Toolbar Toolbar1
Height = 570
Index = 0
Left = 1920
TabIndex = 15
Top = 720
Width = 1695
_ExtentX = 2990
_ExtentY = 1005
ButtonWidth = 2408
ButtonHeight = 1005
Style = 1
TextAlignment = 1
ImageList = "ImageList1"
_Version = 393216
BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628}
NumButtons = 1
BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628}
Caption = "開始篩選"
Object.ToolTipText = "輸入符合您設置條件特征的職工信息列表"
ImageIndex = 1
EndProperty
EndProperty
End
End
Begin VB.Frame Frame1
Caption = "選擇要顯示的字段"
Height = 975
Left = 100
TabIndex = 0
Top = 50
Width = 5175
Begin VB.CheckBox Check1
Caption = "全選"
Height = 615
Left = 120
Style = 1 'Graphical
TabIndex = 14
Top = 240
Width = 735
End
Begin VB.CheckBox hf
Caption = "婚否"
Height = 255
Left = 4200
TabIndex = 8
Top = 600
Value = 1 'Checked
Width = 735
End
Begin VB.CheckBox gz
Caption = "工資"
Height = 255
Left = 4200
TabIndex = 7
Top = 240
Width = 735
End
Begin VB.CheckBox xl
Caption = "學歷"
Height = 255
Left = 3240
TabIndex = 6
Top = 600
Width = 975
End
Begin VB.CheckBox zc
Caption = "職稱"
Height = 255
Left = 2280
TabIndex = 5
Top = 600
Value = 1 'Checked
Width = 735
End
Begin VB.CheckBox csly
Caption = "出生年月"
Height = 255
Left = 960
TabIndex = 4
Top = 600
Value = 1 'Checked
Width = 1215
End
Begin VB.CheckBox xb
Caption = "性別"
Height = 255
Left = 3240
TabIndex = 3
Top = 240
Width = 975
End
Begin VB.CheckBox xm
Caption = "姓名"
Height = 255
Left = 2280
TabIndex = 2
Top = 240
Value = 1 'Checked
Width = 855
End
Begin VB.CheckBox zgbh
Caption = "職工編號"
Height = 255
Left = 960
TabIndex = 1
Top = 240
Width = 1215
End
End
End
Attribute VB_Name = "frmSelect"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click()
zgbh.Value = Check1.Value
xm.Value = Check1.Value
xb.Value = Check1.Value
csly.Value = Check1.Value
zc.Value = Check1.Value
gz.Value = Check1.Value
hf.Value = Check1.Value
xl.Value = Check1.Value
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2, Me.Width, Me.Height
AniShowFrm Me.hwnd
End Sub
Private Sub Form_Unload(Cancel As Integer)
AniUnloadFrm Me.hwnd
End Sub
Private Sub Toolbar1_ButtonClick(Index As Integer, ByVal Button As MSComctlLib.Button)
On Error GoTo Err:
Dim StrSql As String
StrSql = "select "
If zgbh.Value = 1 Then StrSql = StrSql + "職工編號,"
If xm.Value = 1 Then StrSql = StrSql + "姓名,"
If xb.Value = 1 Then StrSql = StrSql + "性別,"
If gz.Value = 1 Then StrSql = StrSql + "工資,"
If csly.Value = 1 Then StrSql = StrSql + "出生年月,"
If zc.Value = 1 Then StrSql = StrSql + "職稱,"
If xl.Value = 1 Then StrSql = StrSql + "最后學歷,"
If hf.Value = 1 Then StrSql = StrSql + "婚否,"
StrSql = Left(StrSql, Len(StrSql) - 1)
StrSql = StrSql + " from 職工信息 where " + Combo1
If Combo1 = "工資" Then
If lblEqual.Value Then StrSql = StrSql + " = " + txtCompare
If lblLarge.Value Then StrSql = StrSql + " > " + txtCompare
If lblSmall.Value Then StrSql = StrSql + " < " + txtCompare
If lblLike.Value Then StrSql = StrSql + " like *" + txtCompare
Else
If lblEqual.Value Then StrSql = StrSql + " = '" + txtCompare + "'"
If lblLarge.Value Then StrSql = StrSql + " > '" + txtCompare + "'"
If lblSmall.Value Then StrSql = StrSql + " < '" + txtCompare + "'"
If lblLike.Value Then StrSql = StrSql + " like *'" + txtCompare + "*'"
End If
StrSql = StrSql + " order by " + Combo1
MsgBox StrSql, , "SQL查詢語句:"
'frmDocument.Data1.RecordSource = "select 姓名,工資,性別 from 職工信息 where 工資 > 1000"
frmDocument.Data1.RecordSource = StrSql
frmDocument.Data1.Refresh
Exit Sub
Err: MsgBox "查找出錯!請您檢查選擇的查詢條件是否正確" & vbCrLf & "錯誤內容:" & Err.Description, vbCritical, "提示:"
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -