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

📄 form1.frm

📁 图像识别fdsaffdsafdsaffdsafsaf
💻 FRM
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "Simple Search"
   ClientHeight    =   3960
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4440
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   3960
   ScaleWidth      =   4440
   StartUpPosition =   2  '屏幕中心
   Begin MSComDlg.CommonDialog cdgPath 
      Left            =   3840
      Top             =   840
      _ExtentX        =   847
      _ExtentY        =   847
      _Version        =   393216
   End
   Begin VB.ComboBox Cbo_Operator 
      Height          =   315
      ItemData        =   "Form1.frx":0000
      Left            =   2640
      List            =   "Form1.frx":0013
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   2760
      Width           =   1695
   End
   Begin VB.ComboBox Cbo_Category 
      Height          =   315
      ItemData        =   "Form1.frx":002C
      Left            =   960
      List            =   "Form1.frx":0039
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   2760
      Width           =   1575
   End
   Begin VB.TextBox Text4 
      DataField       =   "ContactTitle"
      DataSource      =   "Data1"
      Height          =   285
      Left            =   1080
      TabIndex        =   4
      Text            =   "Text4"
      Top             =   1800
      Width           =   2535
   End
   Begin VB.TextBox Text3 
      DataField       =   "ContactName"
      DataSource      =   "Data1"
      Height          =   285
      Left            =   1080
      TabIndex        =   3
      Text            =   "Text3"
      Top             =   1080
      Width           =   2535
   End
   Begin VB.TextBox Text2 
      DataField       =   "CompanyName"
      DataSource      =   "Data1"
      Height          =   285
      Left            =   1080
      TabIndex        =   2
      Text            =   "Text2"
      Top             =   360
      Width           =   2535
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   120
      TabIndex        =   1
      Top             =   2160
      Width           =   4215
   End
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "D:\VB98\Nwind.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   345
      Left            =   120
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "Customers"
      Top             =   3480
      Width           =   4095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Search"
      Height          =   255
      Left            =   120
      TabIndex        =   0
      Top             =   2520
      Width           =   735
   End
   Begin VB.Label Label5 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Comparison Operator :"
      Height          =   255
      Left            =   2640
      TabIndex        =   11
      Top             =   2520
      Width           =   1695
   End
   Begin VB.Label Label4 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Category to Search :"
      Height          =   255
      Left            =   960
      TabIndex        =   10
      Top             =   2520
      Width           =   1575
   End
   Begin VB.Label Label3 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Contact Title :"
      Height          =   255
      Left            =   1080
      TabIndex        =   9
      Top             =   1560
      Width           =   1215
   End
   Begin VB.Label Label2 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Contact Name :"
      Height          =   255
      Left            =   1080
      TabIndex        =   8
      Top             =   840
      Width           =   1215
   End
   Begin VB.Label Label1 
      BorderStyle     =   1  'Fixed Single
      Caption         =   "Company Name :"
      Height          =   255
      Left            =   1080
      TabIndex        =   7
      Top             =   120
      Width           =   1335
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub Command1_Click()
On Error GoTo OOPS
Dim My_Query As String



MyQuery = Cbo_Category & " " & Cbo_Operator & " '" & Text1.Text & "'"

Data1.RecordSource = "SELECT * FROM Customers WHERE " & MyQuery

Data1.Refresh


Data1.Recordset.MoveLast: Data1.Recordset.MoveFirst
MsgBox Data1.Recordset.RecordCount & " matches found."
Exit Sub
OOPS:
MsgBox "No Records Found"
End Sub

Private Sub Form_Load()
MsgBox "If you use the LIKE method, then you can use the *(wildcard) to complete the query." & vbNewLine & "Like do a search for Ma* or M*ria or *m* etc."
With cdgPath
.Filter = "数据库文件(*.mdb)|*.mdb"
.ShowOpen
End With
Data1.DatabaseName = cdgPath.FileName
Cbo_Category.ListIndex = 0
Cbo_Operator.ListIndex = 0
End Sub

⌨️ 快捷键说明

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