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

📄 main_kcgl_kccx11.frm

📁 商品进销存管理系统 采用VB和SQL2000开发 具有很强的实用性
💻 FRM
字号:
VERSION 5.00
Begin VB.Form main_find 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "查询窗口"
   ClientHeight    =   2190
   ClientLeft      =   45
   ClientTop       =   1785
   ClientWidth     =   6975
   Icon            =   "main_kcgl_kccx.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2190
   ScaleWidth      =   6975
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   360
      Left            =   3570
      TabIndex        =   7
      Top             =   1605
      Width           =   1635
   End
   Begin VB.CommandButton cmdFind 
      Caption         =   "查询"
      Height          =   360
      Left            =   1860
      TabIndex        =   6
      Top             =   1605
      Width           =   1635
   End
   Begin VB.Frame Frame1 
      Height          =   1155
      Left            =   150
      TabIndex        =   0
      Top             =   195
      Width           =   6645
      Begin VB.ComboBox cboOperator 
         BackColor       =   &H80000018&
         Height          =   300
         ItemData        =   "main_kcgl_kccx.frx":000C
         Left            =   4140
         List            =   "main_kcgl_kccx.frx":000E
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   225
         Width           =   2295
      End
      Begin VB.TextBox txtdata 
         BackColor       =   &H80000018&
         Height          =   300
         Left            =   945
         TabIndex        =   2
         Top             =   690
         Width           =   5490
      End
      Begin VB.ComboBox cboFields 
         BackColor       =   &H80000018&
         Height          =   300
         ItemData        =   "main_kcgl_kccx.frx":0010
         Left            =   945
         List            =   "main_kcgl_kccx.frx":0012
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   255
         Width           =   2295
      End
      Begin VB.Label Label4 
         Caption         =   "关 键 字"
         ForeColor       =   &H00FF0000&
         Height          =   255
         Left            =   135
         TabIndex        =   5
         Top             =   720
         Width           =   1155
      End
      Begin VB.Label Label3 
         Caption         =   "字段名称                             运算符"
         ForeColor       =   &H00FF0000&
         Height          =   285
         Left            =   135
         TabIndex        =   4
         Top             =   315
         Width           =   5280
      End
   End
End
Attribute VB_Name = "main_find"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'*************************************************************************
'**模 块 名:main_find
'**版权说明:吉林省明日科技有限公司享有本软件的所有版权,如果本软件用于商
'**          业用途,必须经过吉林省明日科技有限公司授权。如果提供网上免费
'**          下载,必须经过吉林省明日科技有限公司授权,并保证程序的完整,
'**          不得修改代码、注释和相关内容,否则,我公司将追究其法律责任
'**网    址:www.mingrisoft.com  价值无限,服务无限
'**电    话:(0431)84978981,84978982
'**创 建 人:明日科技
'**日    期:2007-10-31
'**修 改 人:MRLBB
'**日    期:2007-10-31
'**描    述:
'*************************************************************************
Dim fld
Dim rs As New ADODB.Recordset
Private Sub Form_Load()
  rs.Open "select * from " & tb, Cnn, adOpenKeyset, adLockOptimistic
  Set fld = rs.Fields
  For Each fld In rs.Fields
      '向combo控件中添加字段
      cboFields.AddItem fld.Name
  Next
  rs.Close
  cboFields.ListIndex = 0
  '向cboOperator中添加查询条件
  cboOperator.AddItem ("like")
  cboOperator.AddItem ("=")
  cboOperator.AddItem (">")
  cboOperator.AddItem (">=")
  cboOperator.AddItem ("<")
  cboOperator.AddItem ("<=")
  cboOperator.AddItem ("<>")
  cboOperator.ListIndex = 0
End Sub
Private Sub cmdFind_Click()        '查询
  rs.Open "select * from " & tb, Cnn, adOpenKeyset, adLockOptimistic
'  MsgBox rs.Fields(cboFields.ListIndex).Type
  Select Case rs.Fields(cboFields.ListIndex).Type
    Case 200  '字符型
      If cboOperator.text <> "like" Then
         MsgBox "字符型数据只能选“Like”作为运算符!"
         cboOperator.text = "like"
      End If
      sql = tb & " where " & tb & "." & cboFields & " like+ '" + txtdata + "'+'%'"
    Case 135    '日期型
      If cboOperator.text = "like" Then
         MsgBox "日期型数据不能选用“Like”作为运算符!"
         Exit Sub
      End If
      If IsDate(txtdata) = False Then
         MsgBox "请输入正确的日期!"
         Exit Sub
      End If
      sql = tb & " where " & tb & "." & cboFields & cboOperator & "'" + txtdata + "'"
    Case 5     '数值型
      If IsNumeric(txtdata) = False Then
         MsgBox "请输入正确的数据!"
         Exit Sub
      End If
      If cboOperator.text = "like" Then
         MsgBox "数值型数据不能选用“Like”作为运算符!"
         Exit Sub
      End If
      sql = tb & " where " & tb & "." & cboFields & cboOperator & txtdata
   Case 6
      If cboOperator.text = "like" Then
         MsgBox "数值型数据不能选用“Like”作为运算符!"
         Exit Sub
      End If
      If IsNumeric(txtdata) = False Then
         MsgBox "请输入正确的数据!"
         Exit Sub
      End If
      sql = tb & " where " & tb & "." & cboFields & cboOperator & txtdata
  End Select
  rs.Close
  Unload Me
  
End Sub
Private Sub cmdExit_Click()
  Unload Me
  frm_main.Enabled = True
End Sub



⌨️ 快捷键说明

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