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

📄 frmquerywhere.frm

📁 一个OA办公自动化管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{0D6234D1-DBA2-11D1-B5DF-0060976089D0}#6.0#0"; "TODG6.OCX"
Begin VB.Form frmQueryWhere 
   BackColor       =   &H00C0C0C0&
   Caption         =   "物料查询"
   ClientHeight    =   5580
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   7020
   FillStyle       =   6  'Cross
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   5580
   ScaleWidth      =   7020
   StartUpPosition =   1  '所有者中心
   Begin TrueOleDBGrid60.TDBGrid TDBGrid1 
      Height          =   3375
      Left            =   120
      OleObjectBlob   =   "frmQueryWhere.frx":0000
      TabIndex        =   8
      Top             =   2160
      Width           =   6855
   End
   Begin VB.CommandButton cmdClear 
      BackColor       =   &H00C0C0C0&
      Caption         =   "清除条件"
      Height          =   495
      Left            =   4800
      MaskColor       =   &H00FFFF80&
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   1440
      Width           =   1815
   End
   Begin VB.CommandButton cmdCancel 
      BackColor       =   &H00C0C0C0&
      Caption         =   "取消"
      Height          =   495
      Left            =   4800
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   840
      Width           =   1815
   End
   Begin VB.CommandButton cmdOk 
      BackColor       =   &H00C0C0C0&
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   495
      Left            =   4800
      MaskColor       =   &H0080C0FF&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   240
      Width           =   1815
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H00C0C0C0&
      Caption         =   "查询条件"
      Height          =   1815
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   4335
      Begin VB.TextBox txtName 
         Height          =   375
         Left            =   960
         TabIndex        =   7
         Top             =   1080
         Width           =   2775
      End
      Begin VB.TextBox txtID 
         Height          =   375
         Left            =   960
         TabIndex        =   5
         Top             =   360
         Width           =   2775
      End
      Begin VB.Label Label1 
         BackColor       =   &H00C0C0C0&
         BackStyle       =   0  'Transparent
         Caption         =   "名称"
         Height          =   255
         Left            =   240
         TabIndex        =   6
         Top             =   1200
         Width           =   615
      End
      Begin VB.Label lblID 
         BackColor       =   &H00C0C0C0&
         BackStyle       =   0  'Transparent
         Caption         =   "编号"
         Height          =   255
         Left            =   240
         TabIndex        =   4
         Top             =   480
         Width           =   555
      End
   End
End
Attribute VB_Name = "frmQueryWhere"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim rs As New ADODB.Recordset
Dim sql As String
Dim StrSql As String

Private Sub CmdCancel_Click()
  strInvInfo = ""
  Unload Me
End Sub

Private Sub cmdClear_Click()
  
  txtID.Text = ""
  txtName.Text = ""
  
  InitForm
  
End Sub

Private Sub CmdOk_Click()
    strInvInfo = ""
    On Error GoTo Err_InvInfo
    strInvInfo = Trim(Me.TDBGrid1.Columns("代号").Value)
    strInvInfo = strInvInfo & "|" & Trim(Me.TDBGrid1.Columns("名称").Value)
    strInvInfo = strInvInfo & "|" & Trim(Me.TDBGrid1.Columns("单位").Value)
    strInvInfo = strInvInfo & "|" & Trim(CStr(Me.TDBGrid1.Columns("单价").Value))
    strInvInfo = strInvInfo & "|" & Trim(CStr(Me.TDBGrid1.Columns("库存数").Value))
    strInvInfo = strInvInfo & "|" & Trim(Me.TDBGrid1.Columns("配码类型").Value)
    Unload Me
    DoEvents
    Exit Sub
Err_InvInfo:
    strInvInfo = ""
    MisMsg "InvInfo Error:" & Err.Description
    Exit Sub
    'initForm1Grid
End Sub

Private Sub InitForm()
  
  StrSql = ""
  
  StrSql = "SELECT Inventory.Inventory_ID AS 代号, Inventory.Description AS 名称, Inventory_type.Description as 类型, Inventory.Size_Type AS 配码类型, Inventory.Unit AS 单位, Inventory.Last_Cost AS 单价, Inventory.Balance AS 库存数 FROM Inventory LEFT JOIN Inventory_type ON Inventory.Type = Inventory_type.ID;"
  
  Set rs = New Recordset
  rs.Open StrSql, GetCNLocal, adOpenDynamic, adLockReadOnly
  
  Set TDBGrid1.DataSource = rs
  
  
End Sub

Private Sub Form_Load()
   InitForm
End Sub






Private Sub changeForm()
  
  sql = ""
  sql = "SELECT Inventory.Inventory_ID AS 代号, Inventory.Description AS 名称, Inventory_type.Description as 类型, Inventory.Size_Type AS 配码类型, Inventory.Unit AS 单位, Inventory.Last_Cost AS 单价, Inventory.Balance AS 库存数 FROM Inventory LEFT JOIN Inventory_type ON Inventory.Type = Inventory_type.ID Where 1=1 "

  
  If Trim(txtID.Text) <> "" Then
      sql = sql & "  and  Inventory.Inventory_ID Like '%" & Trim(txtID.Text) & "%'" & " "
  End If
  
  If Trim(txtName.Text) <> "" Then
      sql = sql & " and  Inventory.description like '%" & Trim(txtName.Text) & "%'"
  End If
  
  'MsgBox strSql
  Set rs = New Recordset
  rs.Open sql, GetCNLocal, adOpenDynamic, adLockReadOnly
  
  Set TDBGrid1.DataSource = rs
  
End Sub

Private Sub TDBGrid1_DblClick()
CmdOk_Click
End Sub

Private Sub txtID_Change()
   changeForm
End Sub

Private Sub txtName_Change()
   changeForm
End Sub

⌨️ 快捷键说明

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