?? fairsearch.frm
字號:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form FairSearch
AutoRedraw = -1 'True
BorderStyle = 3 'Fixed Dialog
Caption = "展會查詢系統"
ClientHeight = 4725
ClientLeft = 45
ClientTop = 330
ClientWidth = 8115
ControlBox = 0 'False
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 4725
ScaleWidth = 8115
ShowInTaskbar = 0 'False
Begin MSFlexGridLib.MSFlexGrid Grid1
Height = 2895
Left = 210
TabIndex = 6
Top = 1590
Width = 7665
_ExtentX = 13520
_ExtentY = 5106
_Version = 65541
BackColor = 16777215
ForeColor = 16711680
BackColorFixed = 12632256
BackColorSel = 8454143
ForeColorSel = 12582912
BackColorBkg = 12632064
AllowBigSelection= 0 'False
ScrollBars = 2
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.Frame Frame1
Caption = "查詢模塊建立條件"
ForeColor = &H000040C0&
Height = 1275
Left = 225
TabIndex = 7
Top = 150
Width = 7635
Begin VB.PictureBox Picture1
AutoRedraw = -1 'True
Height = 435
Left = 4590
ScaleHeight = 375
ScaleWidth = 2805
TabIndex = 8
Top = 690
Width = 2865
Begin VB.CommandButton Command1
Caption = "所有(&A)"
Height = 375
Left = 0
TabIndex = 5
Top = 0
Width = 960
End
Begin VB.CommandButton Closeform
Cancel = -1 'True
Caption = "放棄(&C)"
Height = 375
Left = 1890
TabIndex = 4
Top = 0
Width = 915
End
Begin VB.CommandButton Sure
Caption = "查找(&F)"
Enabled = 0 'False
Height = 375
Left = 960
TabIndex = 3
Top = 0
Width = 915
End
End
Begin VB.ComboBox Combo2
Height = 300
Left = 195
Style = 2 'Dropdown List
TabIndex = 0
Top = 360
Width = 2295
End
Begin VB.ComboBox Combo1
Height = 300
Left = 2520
Style = 2 'Dropdown List
TabIndex = 1
Top = 360
Width = 975
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = 3525
TabIndex = 2
Top = 345
Width = 3915
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "請選擇查詢的項目 模式"
ForeColor = &H00800080&
Height = 180
Left = 195
TabIndex = 9
Top = 840
Width = 2700
End
End
End
Attribute VB_Name = "FairSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Db As Database, Ef As Recordset, HH As Integer
Private Sub Closeform_Click()
Unload Me
End Sub
Private Sub Combo1_Click()
SendKeys "{tab}"
End Sub
Private Sub Combo2_Click()
Text1.Text = ""
SendKeys "{tab}"
End Sub
Private Sub Command1_Click()
Grid1.Clear
'配置網格
Grid1.Cols = 4
Grid1.FormatString = "^ 序號 |^ 展會名稱 |^ 展會時間 |^ 展會天數 "
Grid1.ColWidth(0) = 500
Grid1.ColWidth(1) = 5070
Grid1.ColWidth(2) = 1000
Grid1.ColWidth(3) = 1000
Set Db = OpenDatabase(Browser + "Fair.MDB")
Set Ef = Db.OpenRecordset("Fair", dbOpenTable)
Grid1.Rows = Ef.RecordCount + 4
Set Ef = Db.OpenRecordset("Select 展會名稱,展會時間,展會天數 From Fair", dbOpenDynaset)
HH = 1
Do While Not Ef.EOF()
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid1.Text = Ef.Fields(0).Value
End If
Grid1.Row = HH
Grid1.Col = 2
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid1.Text = Ef.Fields(1).Value
End If
Grid1.Row = HH
Grid1.Col = 3
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid1.Text = Ef.Fields(2).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
Db.Close
For HH = 1 To Grid1.Rows - 1
Grid1.Row = HH
Grid1.Col = 0
Grid1.Text = HH
If Len(Grid1.Text) = 1 Then
Grid1.Text = "0" + Grid1.Text
End If
Next
End Sub
Private Sub Form_Load()
FairSearch.Left = Menu.Width
FairSearch.Top = Menu.Height - FairSearch.Height
'初始化二個列表框
Combo1.AddItem "等于", 0
Combo1.AddItem "包含", 1
Combo1.ListIndex = 0
Combo2.AddItem "展會名稱", 0
Combo2.AddItem "展會地點", 1
Combo2.AddItem "舉辦單位", 2
Combo2.AddItem "傳真", 3
Combo2.AddItem "電話", 4
Combo2.AddItem "聯系人", 5
Combo2.AddItem "郵件", 6
Combo2.AddItem "網址", 7
Combo2.AddItem "展會時間", 8
Combo2.AddItem "展會天數", 9
Combo2.AddItem "展會內容", 10
Combo2.AddItem "地址", 11
Combo2.ListIndex = 0
'配置網格
Grid1.Cols = 4
Grid1.FormatString = "^ 序號 |^ 展會名稱 |^ 展會時間 |^ 展會天數 "
Grid1.ColWidth(0) = 500
Grid1.ColWidth(1) = 5070
Grid1.ColWidth(2) = 1000
Grid1.ColWidth(3) = 1000
Set Db = OpenDatabase(Browser + "Fair.MDB")
Set Ef = Db.OpenRecordset("Fair", dbOpenTable)
Grid1.Rows = Ef.RecordCount + 4
Set Ef = Db.OpenRecordset("Select 展會名稱,展會時間,展會天數 From Fair", dbOpenDynaset)
HH = 1
Do While Not Ef.EOF()
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid1.Text = Ef.Fields(0).Value
End If
Grid1.Row = HH
Grid1.Col = 2
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid1.Text = Ef.Fields(1).Value
End If
Grid1.Row = HH
Grid1.Col = 3
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid1.Text = Ef.Fields(2).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
Db.Close
For HH = 1 To Grid1.Rows - 1
Grid1.Row = HH
Grid1.Col = 0
Grid1.Text = HH
If Len(Grid1.Text) = 1 Then
Grid1.Text = "0" + Grid1.Text
End If
Next
FileName = "yusilong"
End Sub
Private Sub Grid1_DblClick()
If Grid1.MouseCol = 0 Or Grid1.MouseRow = 0 Or Grid1.Text = "" Then Exit Sub
TranStr = Grid1.Text
FairSearch.MousePointer = 11
Load SearchDisplay
FairSearch.MousePointer = 0
SearchDisplay.Show 1
End Sub
Private Sub Sure_Click()
If Combo2.Text = "展會時間" Then
If VerifyDate(Text1.Text) = False Then
MsgBox "日期有空格或者日期有錯誤!", vbOKOnly + 16, "提示:"
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.SetFocus
Exit Sub
End If
End If
Select Case Combo1.Text
Case "等于"
Select Case Combo2.Text
Case "展會名稱"
PublicFindStr = "展會名稱='" & Trim(Text1.Text) & "'"
Case "展會地點"
PublicFindStr = "展會地點='" & Trim(Text1.Text) & "'"
Case "電話"
PublicFindStr = "電話='" & Trim(Text1.Text) & "'"
Case "舉辦單位"
PublicFindStr = "舉辦單位='" & Trim(Text1.Text) & "'"
Case "聯系人"
PublicFindStr = "聯系人='" & Trim(Text1.Text) & "'"
Case "郵件"
PublicFindStr = "郵件='" & Trim(Text1.Text) & "'"
Case "傳真"
PublicFindStr = "傳真='" & Trim(Text1.Text) & "'"
Case "網址"
PublicFindStr = "網址='" & Trim(Text1.Text) & "'"
Case "展會時間"
PublicFindStr = "展會時間=#" & Trim(Text1.Text) & "#"
Case "展會天數"
PublicFindStr = "展會天數=" & Trim(Text1.Text)
Case "展會內容"
PublicFindStr = "展會內容='" & Trim(Text1.Text) & "'"
Case "地址"
PublicFindStr = "地址='" & Trim(Text1.Text) & "'"
End Select
Case "包含"
Select Case Combo2.Text
Case "展會名稱"
PublicFindStr = "展會名稱 Like '*" & Trim(Text1.Text) & "*'"
Case "展會地點"
PublicFindStr = "展會地點 Like '*" & Trim(Text1.Text) & "*'"
Case "電話"
PublicFindStr = "電話 Like '*" & Trim(Text1.Text) & "*'"
Case "舉辦單位"
PublicFindStr = "舉辦單位 Like '*" & Trim(Text1.Text) & "*'"
Case "聯系人"
PublicFindStr = "聯系人 Like '*" & Trim(Text1.Text) & "*'"
Case "郵件"
PublicFindStr = "郵件 Like '*" & Trim(Text1.Text) & "*'"
Case "傳真"
PublicFindStr = "傳真 Like '*" & Trim(Text1.Text) & "*'"
Case "網址"
PublicFindStr = "網址 Like '*" & Trim(Text1.Text) & "*'"
Case "展會時間"
PublicFindStr = "展會時間 > #" & Trim(Text1.Text) & "#"
Case "展會天數"
PublicFindStr = "展會天數 >" & Trim(Text1.Text)
Case "展會內容"
PublicFindStr = "展會內容 Like '*" & Trim(Text1.Text) & "*'"
Case "地址"
PublicFindStr = "地址 Like '*" & Trim(Text1.Text) & "*'"
End Select
End Select
'高級查找經過以下
'查找記錄
Dim Db As Database, Ef As Recordset
Set Db = OpenDatabase(Browser + "Fair.MDB")
Set Ef = Db.OpenRecordset("Fair", dbOpenDynaset)
Ef.FindFirst PublicFindStr
'Data1.Recordset.FindFirst PublicFindStr
If Ef.NoMatch Then
'If Data1.Recordset.NoMatch Then
MsgBox "沒有查找到滿足條件的展會記錄", vbOKOnly + 48, "查找記錄"
PublicFindStr = ""
Text1.Text = ""
Text1.SetFocus
Exit Sub
Else
'Display code
'配置網格
Grid1.Clear
Grid1.Cols = 4
Grid1.FormatString = "^ 序號 |^ 展會名稱 |^ 展會時間 |^ 展會天數 "
Grid1.ColWidth(0) = 500
Grid1.ColWidth(1) = 5070
Grid1.ColWidth(2) = 1000
Grid1.ColWidth(3) = 1000
Set Db = OpenDatabase(Browser + "Fair.MDB")
Set Ef = Db.OpenRecordset("Fair", dbOpenTable)
Grid1.Rows = Ef.RecordCount + 4
Set Ef = Db.OpenRecordset("Select 展會名稱,展會時間,展會天數 From Fair where " & PublicFindStr, dbOpenDynaset)
HH = 1
Do While Not Ef.EOF()
Grid1.Row = HH
Grid1.Col = 1
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(0).Value) Then
Grid1.Text = Ef.Fields(0).Value
End If
Grid1.Row = HH
Grid1.Col = 2
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(1).Value) Then
Grid1.Text = Ef.Fields(1).Value
End If
Grid1.Row = HH
Grid1.Col = 3
Grid1.CellAlignment = 1
If Not IsNull(Ef.Fields(2).Value) Then
Grid1.Text = Ef.Fields(2).Value
End If
Ef.MoveNext
HH = HH + 1
Loop
Db.Close
For HH = 1 To Grid1.Rows - 1
Grid1.Row = HH
Grid1.Col = 0
Grid1.Text = HH
If Len(Grid1.Text) = 1 Then
Grid1.Text = "0" + Grid1.Text
End If
Next
Exit Sub
End If
End Sub
Private Sub Text1_Change()
If Trim(Text1.Text) = "" Then
Sure.Enabled = False
Else
Sure.Enabled = True
End If
If Combo2.Text = "展會時間" Then
If Len(Text1.Text) = 4 Or Len(Text1.Text) = 7 Then
Text1.Text = Text1.Text + "/"
Text1.SelStart = Len(Text1.Text)
Text1.SelLength = 0
End If
End If
End Sub
Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
Text1.BackColor = &HFF0000
Text1.ForeColor = &HFFFFFF
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Sure.Enabled = True Then Sure.SetFocus
Exit Sub
End If
If Combo2.Text = "展會時間" Then
If KeyAscii = 8 Then Exit Sub
If KeyAscii < 47 Or KeyAscii > 57 Then
KeyAscii = 0
Exit Sub
End If
End If
If Combo2.Text = "展會天數" Then
If KeyAscii = 8 Then Exit Sub
If KeyAscii < 48 Or KeyAscii > 57 Then
KeyAscii = 0
Exit Sub
End If
End If
End Sub
Private Sub Text1_LostFocus()
Text1.BackColor = &HFFFFFF
Text1.ForeColor = &H0
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -