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

📄 frmprocl.frm

📁 学院MIS管理系统,适合大部分毕业生,请大家支持
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FrmProcl 
   BackColor       =   &H8000000D&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "查询/浏览财产信息"
   ClientHeight    =   6840
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   8415
   Icon            =   "FrmProcl.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   ScaleHeight     =   6840
   ScaleWidth      =   8415
   Begin VB.CommandButton cmdexit 
      Caption         =   "退出查询"
      Height          =   330
      Left            =   6820
      TabIndex        =   16
      Top             =   6360
      Width           =   1300
   End
   Begin VB.Frame Frame2 
      BackColor       =   &H8000000D&
      Height          =   1935
      Left            =   6600
      TabIndex        =   11
      Top             =   4200
      Width           =   1695
      Begin VB.CommandButton cmdcha 
         Caption         =   "查询语句开关"
         Height          =   330
         Left            =   220
         TabIndex        =   15
         Top             =   1100
         Width           =   1300
      End
      Begin VB.CommandButton Command1 
         Caption         =   "显示全部"
         Height          =   330
         Left            =   220
         TabIndex        =   14
         Top             =   650
         Width           =   1300
      End
      Begin VB.CommandButton Command2 
         Caption         =   "打印报表"
         Height          =   330
         Left            =   220
         TabIndex        =   13
         Top             =   1500
         Width           =   1300
      End
      Begin VB.CommandButton cmdInquire 
         Caption         =   "确定查询"
         Default         =   -1  'True
         Height          =   330
         Left            =   220
         TabIndex        =   12
         Top             =   230
         Width           =   1300
      End
   End
   Begin VB.Frame Frame1 
      BackColor       =   &H8000000D&
      Caption         =   "查询"
      ForeColor       =   &H0080FFFF&
      Height          =   1935
      Left            =   120
      TabIndex        =   0
      Top             =   4200
      Width           =   6255
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   4200
         TabIndex        =   9
         Top             =   1200
         Width           =   1695
      End
      Begin VB.ComboBox Cbo_Operator 
         Height          =   300
         Index           =   1
         ItemData        =   "FrmProcl.frx":09CA
         Left            =   2280
         List            =   "FrmProcl.frx":09E3
         Style           =   2  'Dropdown List
         TabIndex        =   8
         Top             =   1200
         Width           =   1695
      End
      Begin VB.ComboBox Cbo_Category 
         Height          =   300
         Index           =   1
         ItemData        =   "FrmProcl.frx":0A02
         Left            =   480
         List            =   "FrmProcl.frx":0A04
         Style           =   2  'Dropdown List
         TabIndex        =   7
         Top             =   1200
         Width           =   1575
      End
      Begin VB.CheckBox Check1 
         BackColor       =   &H8000000D&
         Caption         =   "Check1"
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   6
         TabStop         =   0   'False
         Top             =   1200
         Width           =   255
      End
      Begin VB.CheckBox Check1 
         BackColor       =   &H8000000D&
         Caption         =   "Check1"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   2
         TabStop         =   0   'False
         Top             =   600
         Width           =   255
      End
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   4200
         TabIndex        =   5
         Top             =   600
         Width           =   1695
      End
      Begin VB.ComboBox Cbo_Operator 
         Height          =   300
         Index           =   0
         ItemData        =   "FrmProcl.frx":0A06
         Left            =   2280
         List            =   "FrmProcl.frx":0A1F
         Style           =   2  'Dropdown List
         TabIndex        =   4
         Top             =   600
         Width           =   1695
      End
      Begin VB.ComboBox Cbo_Category 
         Height          =   300
         Index           =   0
         ItemData        =   "FrmProcl.frx":0A3E
         Left            =   480
         List            =   "FrmProcl.frx":0A40
         Style           =   2  'Dropdown List
         TabIndex        =   3
         Top             =   600
         Width           =   1575
      End
   End
   Begin MSFlexGridLib.MSFlexGrid myflexgrid 
      Height          =   3975
      Left            =   120
      TabIndex        =   1
      TabStop         =   0   'False
      Top             =   120
      Width           =   8175
      _ExtentX        =   14420
      _ExtentY        =   7011
      _Version        =   393216
      Cols            =   8
      FixedCols       =   0
      RowHeightMin    =   560
      WordWrap        =   -1  'True
      FillStyle       =   1
      SelectionMode   =   2
      AllowUserResizing=   3
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
   End
   Begin VB.Label Label1 
      BackColor       =   &H8000000D&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   10.5
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H0080FFFF&
      Height          =   735
      Left            =   120
      TabIndex        =   10
      Top             =   6195
      Width           =   6495
   End
End
Attribute VB_Name = "FrmProcl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim t As Integer
Dim myquery(1) As String
Private Sub Cbo_Category_Change(Index As Integer)
For i = 0 To 1
Select Case Cbo_Category(i).Text
   Case Is = "使用人"
      myquery(i) = "shiyongren"
   Case Is = "编号"
      myquery(i) = "caichan_id"
   Case Is = "型号"
      myquery(i) = "xinghao"
   Case Is = "名称"
      myquery(i) = "caichanname"
   Case Is = "日期"
      myquery(i) = "riqi"
     
   Case Else
End Select
Next i
End Sub

Private Sub Cbo_Category_Click(Index As Integer)
For i = 0 To 1
Select Case Cbo_Category(i).Text
   Case Is = "使用人"
      myquery(i) = "shiyongren"
   Case Is = "编号"
      myquery(i) = "caichan_id"
   Case Is = "型号"
      myquery(i) = "xinghao"
   Case Is = "名称"
      myquery(i) = "caichanname"
   Case Is = "日期"
      myquery(i) = "riqi"
   Case Else
End Select
Next i
End Sub
Private Sub cmdcha_Click()
t = t Mod 2
If t = 1 Then
Label1.Visible = False
Else
Label1.Visible = True
End If
t = t + 1
End Sub

Private Sub cmdExit_Click()
 Unload Me
End Sub

Private Sub cmdInquire_Click()
On Error GoTo OOPS
     Dim txtSQL As String
     Dim MsgText As String
     Dim dd(2) As Boolean
     Dim mrc As ADODB.Recordset
     txtSQL = "select * from caichanguanli where "
      '判断是否选择第一查询方式
     If Check1(0).value Then
        If Trim(Text1.Text) = "" Then
           sMeg = "查询不能为空!"
           MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
           Text1.SetFocus
           Exit Sub
        Else
           dd(0) = True
           If Cbo_Operator(0).ListIndex = 0 Then
             txtSQL = txtSQL & "" & myquery(0) & " " & Cbo_Operator(0) & "  '%" & Text1.Text & "%'"
           Else
            txtSQL = txtSQL & "" & myquery(0) & " " & Cbo_Operator(0) & "  '" & Text1.Text & "'"
           End If
        End If
     End If
    '判断是否选择第二查询方式
    If Check1(1).value Then
        If Trim(Text2.Text) = "" Then
            sMeg = "查询不能为空!"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            Text2.SetFocus
            Exit Sub
        Else
            dd(1) = True
            
           If dd(0) Then
          '组合查询语句
              If Cbo_Operator(1).ListIndex = 0 Then
                txtSQL = txtSQL & " and " & myquery(1) & " " & Cbo_Operator(1).Text & "  '%" & Text2.Text & "%'"
                
              Else
                txtSQL = txtSQL & "  and  " & "" & myquery(1) & " " & Cbo_Operator(1).Text & "  '" & Text2.Text & "'"
                
              End If
           Else
               
              If Cbo_Operator(1).ListIndex = 0 Then
                txtSQL = txtSQL & "" & myquery(1) & " " & Cbo_Operator(1).Text & "  '%" & Text2.Text & "%'"
              Else
                txtSQL = txtSQL & " " & "" & myquery(1) & " " & Cbo_Operator(1).Text & "  '" & Text2.Text & "'"
              End If
          
           End If
           
        End If
   End If
   
  '判断是否设置查询方式
  If Not (dd(0) Or dd(1)) Then
    MsgBox "请设置查询方式!", vbOKOnly + vbExclamation, "警告"
    
    Exit Sub
  End If
    '查询所有满足条件的内容
    txtSQL = txtSQL & " order by caichan_id"
    '执行查询语句
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    '将查询内容显示在表格控件中
    Label1.Caption = txtSQL
    With myflexgrid
     .Rows = 1
     .CellAlignment = 4
     .TextMatrix(0, 0) = "编号"
     .TextMatrix(0, 1) = "名称"
     .TextMatrix(0, 2) = "规格"
     .TextMatrix(0, 3) = "型号"
     .TextMatrix(0, 4) = "数量"
     .TextMatrix(0, 5) = "使用人"
     .TextMatrix(0, 6) = "日期"
     .TextMatrix(0, 7) = "备注"
     '判断是否移动到数据集对象的最后一条记录
     Do While Not mrc.EOF
        .Rows = .Rows + 1
        .CellAlignment = 4
        .TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
        .TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
        .TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
        .TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
        .TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
        .TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
        .TextMatrix(.Rows - 1, 6) = "" & Format(mrc.Fields(6), "yyyy-mm-dd")
        .TextMatrix(.Rows - 1, 7) = "" & mrc.Fields(7)
        
        '移动到下一条记录
        mrc.MoveNext
    Loop
      If myflexgrid.Rows = 1 Then GoTo OOPS
       
   End With
   '关闭数据集
    mrc.Close
  Exit Sub
  
OOPS:
  MsgBox "无此记录!"
  
   
End Sub

Private Sub Command1_Click()
   Dim txtSQL As String
     Dim MsgText As String
     Dim dd(4) As Boolean
     Dim mrc As ADODB.Recordset
  '显示所有记录

 txtSQL = "select * from caichanguanli "
  Set mrc = ExecuteSQL(txtSQL, MsgText)
  With myflexgrid
     .Rows = 1
     .CellAlignment = 4
     .TextMatrix(0, 0) = "编号"
     .TextMatrix(0, 1) = "名称"
     .TextMatrix(0, 2) = "型号"
     .TextMatrix(0, 3) = "规格"
     .TextMatrix(0, 4) = "使用人"
     .TextMatrix(0, 5) = "数量"
     .TextMatrix(0, 6) = "日期"
     .TextMatrix(0, 7) = "备注"
    
    Do While Not mrc.EOF
        .Rows = .Rows + 1
        .CellAlignment = 4
        .TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
        .TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
        .TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
        .TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
        .TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
        .TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
        .TextMatrix(.Rows - 1, 6) = "" & Format(mrc.Fields(6), "yyyy-mm-dd")
        .TextMatrix(.Rows - 1, 7) = "" & mrc.Fields(7)
       
        '移动到下一条记录
        mrc.MoveNext
    Loop
   End With
End Sub
Private Sub Command2_Click()
frmDatapro.Show
End Sub

'初始化网格
Private Sub Form_Load()
 Dim txtSQL As String
     Dim MsgText As String
     Dim dd(4) As Boolean
     Dim mrc As ADODB.Recordset
     t = 0
     Label1.Visible = False
With myflexgrid
     .ColWidth(0) = 1000
     .ColWidth(1) = 1000
     .ColWidth(2) = 1000
     .ColWidth(3) = 1000
     .ColWidth(4) = 1500
     .ColWidth(5) = 1000
     .ColWidth(6) = 1500
     .ColWidth(7) = 1050
     .CellAlignment = 4
     .TextMatrix(0, 0) = "编号"
     .TextMatrix(0, 1) = "名称"
     .TextMatrix(0, 2) = "型号"
     .TextMatrix(0, 3) = "规格"
     .TextMatrix(0, 4) = "使用人"
     .TextMatrix(0, 5) = "数量"
     .TextMatrix(0, 6) = "日期"
     .TextMatrix(0, 7) = "备注"
    
    
End With
  For i = 0 To 1
     Cbo_Category(i).AddItem "编号"
     Cbo_Category(i).AddItem "名称"
     Cbo_Category(i).AddItem "型号"
     Cbo_Category(i).AddItem "使用人"
     Cbo_Category(i).AddItem "日期"
    
    Cbo_Category(i).ListIndex = 0
    Cbo_Operator(i).ListIndex = 0
  Next i
  
  '显示所有记录

 txtSQL = "select * from caichanguanli "
  Set mrc = ExecuteSQL(txtSQL, MsgText)
  
  With myflexgrid
  
     .Rows = 1
     .CellAlignment = 4
     .TextMatrix(0, 0) = "编号"
     .TextMatrix(0, 1) = "名称"
     .TextMatrix(0, 2) = "型号"
     .TextMatrix(0, 3) = "规格"
     .TextMatrix(0, 4) = "使用人"
     .TextMatrix(0, 5) = "数量"
     .TextMatrix(0, 6) = "日期"
     .TextMatrix(0, 7) = "备注"
    
    Do While Not mrc.EOF
        .Rows = .Rows + 1
        .CellAlignment = 4
        .TextMatrix(.Rows - 1, 0) = "" & mrc.Fields(0)
        .TextMatrix(.Rows - 1, 1) = "" & mrc.Fields(1)
        .TextMatrix(.Rows - 1, 2) = "" & mrc.Fields(2)
        .TextMatrix(.Rows - 1, 3) = "" & mrc.Fields(3)
        .TextMatrix(.Rows - 1, 4) = "" & mrc.Fields(4)
        .TextMatrix(.Rows - 1, 5) = "" & mrc.Fields(5)
        .TextMatrix(.Rows - 1, 6) = "" & Format(mrc.Fields(6), "yyyy-mm-dd")
        .TextMatrix(.Rows - 1, 7) = "" & mrc.Fields(7)
       
        '移动到下一条记录
        mrc.MoveNext
    Loop
   End With
 
End Sub



⌨️ 快捷键说明

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