⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmsearchguest.frm

📁 档案管理系统源码VB档案管理系统源码VB
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmSearchGuest 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00C0E0FF&
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "客户查询机构 ==^_^=="
   ClientHeight    =   4155
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6570
   Icon            =   "frmSearchGuest.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4155
   ScaleWidth      =   6570
   ShowInTaskbar   =   0   'False
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "单项查询"
      ForeColor       =   &H000000C0&
      Height          =   960
      Left            =   240
      TabIndex        =   14
      Top             =   225
      Width           =   5010
      Begin VB.TextBox Text1 
         Height          =   330
         Left            =   2865
         TabIndex        =   0
         Top             =   390
         Width           =   1905
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   1875
         Style           =   2  'Dropdown List
         TabIndex        =   5
         Top             =   405
         Width           =   840
      End
      Begin VB.ComboBox Combo2 
         Height          =   300
         Left            =   225
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   405
         Width           =   1530
      End
   End
   Begin VB.CommandButton Sure 
      Caption         =   "查找"
      Enabled         =   0   'False
      Height          =   375
      Left            =   5430
      TabIndex        =   1
      Top             =   225
      Width           =   915
   End
   Begin VB.CommandButton Closeform 
      Cancel          =   -1  'True
      Caption         =   "放弃"
      Height          =   375
      Left            =   5430
      TabIndex        =   2
      Top             =   615
      Width           =   915
   End
   Begin VB.CommandButton Advance 
      Caption         =   "高级"
      Height          =   375
      Left            =   5430
      TabIndex        =   3
      Top             =   1005
      Width           =   915
   End
   Begin VB.CommandButton Restore 
      Caption         =   "低级查找"
      Height          =   375
      Left            =   4440
      TabIndex        =   11
      Top             =   3330
      Width           =   915
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H00C0E0FF&
      Caption         =   "多项查询条件"
      ForeColor       =   &H00C00000&
      Height          =   990
      Left            =   225
      TabIndex        =   13
      Top             =   1770
      Width           =   5025
      Begin VB.ComboBox Combo3 
         Height          =   300
         Left            =   255
         Style           =   2  'Dropdown List
         TabIndex        =   7
         Top             =   450
         Width           =   1485
      End
      Begin VB.ComboBox Combo4 
         Height          =   300
         Left            =   1875
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   450
         Width           =   930
      End
      Begin VB.TextBox Text3 
         Height          =   300
         Left            =   2940
         TabIndex        =   6
         Top             =   450
         Width           =   1830
      End
   End
   Begin VB.CommandButton Addif 
      Caption         =   "添加条件"
      Enabled         =   0   'False
      Height          =   375
      Left            =   5475
      TabIndex        =   12
      Top             =   3330
      Width           =   915
   End
   Begin VB.OptionButton Option1 
      BackColor       =   &H00C0E0FF&
      Caption         =   "和"
      Height          =   240
      Left            =   5535
      TabIndex        =   9
      Top             =   2055
      Width           =   555
   End
   Begin VB.OptionButton Option2 
      BackColor       =   &H00C0E0FF&
      Caption         =   "或"
      Height          =   255
      Left            =   5550
      TabIndex        =   10
      Top             =   2400
      Width           =   615
   End
   Begin VB.Line Line1 
      X1              =   120
      X2              =   6390
      Y1              =   1560
      Y2              =   1560
   End
   Begin VB.Line Line2 
      BorderColor     =   &H00FFFFFF&
      X1              =   120
      X2              =   6405
      Y1              =   1590
      Y2              =   1590
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "综合条件列表"
      ForeColor       =   &H000000FF&
      Height          =   180
      Left            =   1740
      TabIndex        =   16
      Top             =   2910
      Width           =   1080
   End
   Begin VB.Label Iflist 
      BackColor       =   &H00808000&
      BorderStyle     =   1  'Fixed Single
      ForeColor       =   &H00FFFFFF&
      Height          =   735
      Left            =   255
      TabIndex        =   15
      Top             =   3195
      Width           =   3900
      WordWrap        =   -1  'True
   End
End
Attribute VB_Name = "frmSearchGuest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Addif_Click()
Dim TempStr As String
Select Case Combo4.Text
   Case "等于"
      Select Case Combo3.Text
           Case "文件姓名"
           TempStr = "文件姓名='" & Trim(Text3.Text) & "'"
           Case "公司名称"
           TempStr = "公司名称='" & Trim(Text3.Text) & "'"
           Case "公司电话"
           TempStr = "公司电话='" & Trim(Text3.Text) & "'"
           Case "公司地址"
           TempStr = "公司地址='" & Trim(Text3.Text) & "'"
           Case "公司传真"
           TempStr = "公司传真='" & Trim(Text3.Text) & "'"
           Case "公司邮件"
           TempStr = "公司邮件='" & Trim(Text3.Text) & "'"
           Case "公司网址"
           TempStr = "公司网址='" & Trim(Text3.Text) & "'"
           Case "文件类型"
           TempStr = "文件类型='" & Trim(Text3.Text) & "'"
           Case "邮政编码"
           TempStr = "邮政编码='" & Trim(Text3.Text) & "'"
           Case "所在城市"
           TempStr = "所在城市='" & Trim(Text3.Text) & "'"
           End Select
  Case "包含"
      Select Case Combo3.Text
           Case "文件姓名"
           TempStr = "文件姓名 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司名称"
           TempStr = "公司名称 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司电话"
           TempStr = "公司电话 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司地址"
           TempStr = "公司地址 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司传真"
           TempStr = "公司传真 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司邮件"
           TempStr = "公司邮件 Like '*" & Trim(Text3.Text) & "*'"
           Case "公司网址"
           TempStr = "公司网址 Like '*" & Trim(Text3.Text) & "*'"
           Case "文件类型"
           TempStr = "文件类型 Like '*" & Trim(Text3.Text) & "*'"
           Case "邮政编码"
           TempStr = "邮政编码 Like '*" & Trim(Text3.Text) & "*'"
           Case "所在城市"
           TempStr = "所在城市 Like '*" & Trim(Text3.Text) & "*'"
           End Select
 End Select
 
If Trim(Iflist.Caption) = "" Then
   Iflist.Caption = TempStr
   ElseIf Option1.Value = True Then
       Iflist.Caption = Iflist.Caption & " AND " & TempStr
        Else
        Iflist.Caption = Iflist.Caption & " OR " & TempStr
         End If
 PublicFindstr = Iflist.Caption
 
 '再次输入条件
 Text3.SetFocus
 Text3.SelStart = 0
 Text3.SelLength = Len(Trim(Text3.Text))
 End Sub

Private Sub Advance_Click()
Advance.Enabled = False
frmSearchGuest.Height = 4485
Text1.Text = ""
Text1.Enabled = False
Text3.SetFocus
End Sub

Private Sub closeform_Click()
Unload Me
End Sub


Private Sub Combo1_Click()
  SendKeys "{tab}"
End Sub

Private Sub Combo1_LostFocus()
  If Text1.Enabled = True Then
     Text1.SetFocus
  End If
End Sub

Private Sub Combo2_Click()
  Text1.Text = ""
  SendKeys "{tab}"
End Sub

Private Sub Combo3_Click()
  Text3.Text = ""
  SendKeys "{tab}"
End Sub


Private Sub Combo4_Click()
  SendKeys "{tab}"
End Sub

Private Sub Combo4_LostFocus()
  Text3.SetFocus
End Sub

Private Sub Form_Load()
frmSearchGuest.Left = (frmMain.Width - frmSearchGuest.Width) / 2
frmSearchGuest.Top = (frmMain.Height - frmSearchGuest.Height) / 2 - 400
frmMain.MnuSearchGuest.Enabled = False
'定义小窗口
frmSearchGuest.Height = 1875
'初始化四个列表框
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.ListIndex = 0

Combo4.AddItem "等于", 0
Combo4.AddItem "包含", 1
Combo4.ListIndex = 0

Combo3.AddItem "文件姓名", 0
Combo3.AddItem "公司名称", 1
Combo3.AddItem "公司地址", 2
Combo3.AddItem "公司电话", 3
Combo3.AddItem "公司传真", 4
Combo3.AddItem "公司邮件", 5
Combo3.AddItem "公司网址", 6
Combo3.AddItem "文件类型", 7
Combo3.AddItem "邮政编码", 8
Combo3.AddItem "所在城市", 9
Combo3.ListIndex = 0

Option1.Value = True

SendKeys "{Home}+{End}"
End Sub

Private Sub Form_Resize()
frmSearchGuest.Left = (Screen.Width - frmSearchGuest.Width) / 2
frmSearchGuest.Top = (Screen.Height - frmSearchGuest.Height) / 2 - 800
End Sub

Private Sub Form_Unload(Cancel As Integer)
 frmMain.MnuSearchGuest.Enabled = True
End Sub

Private Sub Iflist_Change()
If Trim(Iflist.Caption) = "" And Trim(Text1.Text) = "" Then
  Sure.Enabled = False
 Else
  Sure.Enabled = True
End If
End Sub

Private Sub Restore_Click()
frmSearchGuest.Height = 1875
Advance.Enabled = True
Text1.Enabled = True
Iflist.Caption = ""
Text3.Text = ""
Text1.SetFocus
Text1.SelStart = 0
Text1.SelLength = Len(Trim(Text1.Text))
End Sub

Private Sub sure_Click()

If Advance.Enabled = True Then
 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) & "'"
           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 = "邮政编码 Like '*" & Trim(Text1.Text) & "*'"
           Case "所在城市"
           PublicFindstr = "所在城市 Like '*" & Trim(Text1.Text) & "*'"
           End Select
  End Select
End If
'高级查找经过以下
  '查找记录
   Dim DB As Database, Ef As Recordset
   Set DB = OpenDatabase(Browser + "data\file.MDB", False, False, ConStr)
   Set Ef = DB.OpenRecordset("Detail", dbOpenDynaset)
       Ef.FindFirst PublicFindstr
       If Ef.NoMatch Then
             MsgBox "没有查找到满足条件的记录", vbOKOnly + 48, "没有找到"
             PublicFindstr = ""
             Text1.Text = ""
             Text3.Text = ""
             Iflist.Caption = ""
             If Advance.Enabled = True Then
                Text1.SetFocus
                Else
                Text3.SetFocus
             End If
             Exit Sub
            Else
             Iflist.Caption = ""
             frmFindDisplay.Show
             frmSearchGuest.Hide
             Exit Sub
         End If
     Exit Sub
End Sub

Private Sub Text1_Change()
If Trim(Text1.Text) = "" And Trim(Iflist.Caption) = "" Then
Sure.Enabled = False
Else
Sure.Enabled = True
End If
End Sub

Private Sub Text1_GotFocus()
Text1.SelStart = 0
Text1.SelLength = Len(Text1.Text)
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If Sure.Enabled = True Then Sure.SetFocus
   End If
End Sub


Private Sub Text3_Change()
If Trim(Text3.Text) = "" Then
   Addif.Enabled = False
   Else
   Addif.Enabled = True
   End If
End Sub

Private Sub Text3_GotFocus()
Text3.SelStart = 0
Text3.SelLength = Len(Text3.Text)
End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
      If Addif.Enabled = False Then Exit Sub
         Addif.SetFocus
      End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -