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

📄 yxfind.frm

📁 VB+SQL开发的管理系统软件,希望能对学习写软件工程文档的同学们有所帮助 转载的新云软件的程序
💻 FRM
字号:
VERSION 5.00
Object = "{CFA7AFF4-3242-4269-9172-7389D695AE01}#1.0#0"; "StoneXP.ocx"
Object = "{DAAC6951-59A4-4C08-9D6E-FE3919B64861}#1.0#0"; "FlexCell.ocx"
Begin VB.Form yxfind 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "音像查询与打印"
   ClientHeight    =   1815
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   10215
   Icon            =   "yxfind.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1815
   ScaleWidth      =   10215
   StartUpPosition =   2  '屏幕中心
   Begin StoneXP.XPFrame XPFrame1 
      Height          =   1815
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   10215
      _ExtentX        =   18018
      _ExtentY        =   3201
      Caption         =   ""
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BackColor       =   12632319
      ForeColor       =   0
      FrameColor      =   16711680
      LeftSpace       =   5
      TopSpace        =   5
      RightSpace      =   5
      BottomSpace     =   5
      CapTionLeft     =   50
      CaptionTop      =   0
      RoundSize       =   0
      Begin StoneXP.XPButton XPButton6 
         Height          =   375
         Left            =   2400
         TabIndex        =   1
         Top             =   1200
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ButtonStyle     =   1
         Caption         =   "打印预览"
         MouseIcon       =   "yxfind.frx":000C
         MousePointer    =   99
      End
      Begin FlexCell.Grid Grid2 
         Height          =   555
         Left            =   240
         TabIndex        =   2
         Top             =   360
         Width           =   9735
         _ExtentX        =   17171
         _ExtentY        =   979
         Appearance      =   0
         Cols            =   7
         Rows            =   2
         ScrollBars      =   0
      End
      Begin StoneXP.XPButton XPButton7 
         Height          =   375
         Left            =   5400
         TabIndex        =   3
         Top             =   1200
         Width           =   1575
         _ExtentX        =   2778
         _ExtentY        =   661
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ButtonStyle     =   1
         Caption         =   "退出窗体"
         MouseIcon       =   "yxfind.frx":0326
         MousePointer    =   99
      End
   End
End
Attribute VB_Name = "yxfind"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Classprint As New OpenRs '定义打印记录集
Private Sub Form_Load()
Grid2.SetRegisterInformation "CNwinndy", "W]vyY-nonvk-u\nty-Zbl_e-`hms^" '进行注册
'********************
Grid2.AllowUserResizing = False
Grid2.DisplayFocusRect = False '改变输入模式为平面
Grid2.Column(0).Width = 0
Grid2.Column(3).Width = 100
Grid2.Column(5).Width = 108
Grid2.Column(6).Width = 200
Grid2.Column(1).CellType = cellComboBox
Grid2.Column(2).CellType = cellComboBox
Grid2.Column(3).CellType = cellComboBox
Grid2.Column(4).CellType = cellComboBox
Grid2.Cell(0, 1).Text = "选择表" '将表格内添入固定内容
Grid2.Cell(0, 2).Text = "查询模式" '将表格内添入固定内容
Grid2.Cell(0, 3).Text = "查询段"
Grid2.Cell(0, 4).Text = "条件"
Grid2.Cell(0, 5).Text = "关键字"
Grid2.Cell(0, 6).Text = "附加条件"
Grid2.ComboBox(1).AddItem "库存" '这里是类似combo框的操作,也是把内容添入combo控件的记录集
Grid2.ComboBox(1).AddItem "销售记录"
Grid2.ComboBox(1).AddItem "入库单"
Grid2.ComboBox(2).AddItem "精确查询"
Grid2.ComboBox(2).AddItem "模糊查询"
'********************
End Sub

Private Sub Grid2_RowColChange(ByVal Row As Long, ByVal Col As Long)
Select Case Grid2.Cell(1, 1).Text
Case "库存"
If Grid2.Cell(1, 2).Text <> "" Then
If Grid2.Cell(1, 2).Text = "精确查询" Then
Grid2.ComboBox(4).Clear '以下清除表格中combo集中的内容,并加入以下内容
Grid2.ComboBox(4).AddItem "="
Grid2.ComboBox(4).AddItem ">"
Grid2.ComboBox(4).AddItem "<"
Grid2.ComboBox(4).AddItem ">="
Grid2.ComboBox(4).AddItem "<="
Grid2.ComboBox(4).AddItem "<>"
Grid2.ComboBox(3).Clear '先清空记录集
Set yx2 = cnn.Execute("select * from 库存")
For i = 1 To 10
Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
Next
Else
Grid2.ComboBox(3).Clear
Grid2.ComboBox(3).AddItem "like"
Grid2.ComboBox(3).Clear
Set yx2 = cnn.Execute("select * from 库存")
For i = 1 To 10
 Select Case i '这里使用case语句是因为模糊查询中数值型是不支持的
   Case 1, 2, 3, 4, 10
   Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
 End Select
Next
End If
End If
Case "入库单"
 If Grid2.Cell(1, 2).Text <> "" Then
If Grid2.Cell(1, 2).Text = "精确查询" Then
Grid2.ComboBox(4).Clear '以下清除表格中combo集中的内容,并加入以下内容
Grid2.ComboBox(4).AddItem "="
Grid2.ComboBox(4).AddItem ">"
Grid2.ComboBox(4).AddItem "<"
Grid2.ComboBox(4).AddItem ">="
Grid2.ComboBox(4).AddItem "<="
Grid2.ComboBox(4).AddItem "<>"
Grid2.ComboBox(3).Clear '先清空记录集
Set yx2 = cnn.Execute("select * from 入库单")
For i = 1 To 13
Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
Next
Else
Grid2.ComboBox(4).Clear
Grid2.ComboBox(4).AddItem "like"
Grid2.ComboBox(3).Clear
Set yx2 = cnn.Execute("select * from 入库单")
For i = 1 To 13
 Select Case i '这里使用case语句是因为模糊查询中数值型是不支持的
   Case 1, 2, 3, 4, 5, 6, 13
   Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
 End Select
Next
End If
End If
Case "销售记录"
 If Grid2.Cell(1, 2).Text <> "" Then
If Grid2.Cell(1, 2).Text = "精确查询" Then
Grid2.ComboBox(4).Clear '以下清除表格中combo集中的内容,并加入以下内容
Grid2.ComboBox(4).AddItem "="
Grid2.ComboBox(4).AddItem ">"
Grid2.ComboBox(4).AddItem "<"
Grid2.ComboBox(4).AddItem ">="
Grid2.ComboBox(4).AddItem "<="
Grid2.ComboBox(4).AddItem "<>"
Grid2.ComboBox(3).Clear '先清空记录集
Set yx2 = cnn.Execute("select * from 销售记录")
For i = 1 To 9
Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
Next
Else
Grid2.ComboBox(4).Clear
Grid2.ComboBox(4).AddItem "like"
Grid2.ComboBox(3).Clear
Set yx2 = cnn.Execute("select * from 销售记录")
For i = 1 To 9
 Select Case i '这里使用case语句是因为模糊查询中数值型是不支持的
   Case 1, 2, 3, 4, 5, 9
   Grid2.ComboBox(3).AddItem yx2.Fields(i - 1).Name
 End Select
Next
End If
End If
End Select
End Sub

Private Sub XPButton6_Click()
On Error GoTo finish '防错代码,防止用户组织语句的错误或其它不可预见的错误发生
If Grid2.Cell(1, 1).Text <> "" And Grid2.Cell(1, 2).Text <> "" And Grid2.Cell(1, 3).Text <> "" And Grid2.Cell(1, 4).Text <> "" And Grid2.Cell(1, 5).Text <> "" Then
    If Grid2.Cell(1, 2).Text = "精确查询" Then
      Select Case Grid2.Cell(1, 3).Text
     Case "数量", "单价", "进货价格", "售出价格", "总价格"
     If Grid2.Cell(1, 1).Text = "销售记录" Then
     yxsql = "select 销售记录.*,音像商品名称 from 销售记录,库存 where 销售记录." & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text & Grid2.Cell(1, 5).Text & " and 销售记录.商品编号=库存.商品编号"
     Else
     yxsql = "select * from " & Grid2.Cell(1, 1).Text & " where " & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text & Grid2.Cell(1, 5).Text
     End If
     Case Else
     If Grid2.Cell(1, 1).Text = "销售记录" Then
     yxsql = "select 销售记录.*,音像商品名称 from 销售记录,库存 where 销售记录." & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text & "'" & Grid2.Cell(1, 5).Text & "' and 销售记录.商品编号=库存.商品编号"
     Else
     yxsql = "select * from " & Grid2.Cell(1, 1).Text & " where " & Grid2.Cell(1, 3).Text & Grid2.Cell(1, 4).Text & "'" & Grid2.Cell(1, 5).Text & "'"
     End If
    End Select
   Else
     If Grid2.Cell(1, 1).Text = "销售记录" Then
     yxsql = "select 销售记录.*,音像商品名称 from 销售记录,库存 where 销售记录." & Grid2.Cell(1, 3).Text & " like '%" & Grid2.Cell(1, 5).Text & "%' and 销售记录.商品编号=库存.商品编号"
     Else
     yxsql = "select * from " & Grid2.Cell(1, 1).Text & " where " & Grid2.Cell(1, 3).Text & " like '%" & Grid2.Cell(1, 5).Text & "%'"
     End If
    End If
    If Grid2.Cell(1, 6).Text <> "" Then
    yxsql = yxsql & " " & Grid2.Cell(1, 6).Text
    End If
'*********以处放入调用报表预览
 Select Case Grid2.Cell(1, 1).Text
  Case "库存"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   classreport.Show '显示报表
   Set classreport.DataSource = Classprint.rs1
   Case "销售记录"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   DataReport1.Show '显示报表
   Set DataReport1.DataSource = Classprint.rs1
   Case "入库单"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   DataReport2.Show '显示报表
   Set DataReport2.DataSource = Classprint.rs1
End Select
ElseIf Grid2.Cell(1, 1).Text <> "" Then
 yxsql = "select * from " & Grid2.Cell(1, 1).Text
 Select Case Grid2.Cell(1, 1).Text
  Case "库存"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   classreport.Show '显示报表
   Set classreport.DataSource = Classprint.rs1
   Case "销售记录"
   yxsql = "select 销售记录.*,音像商品名称 from 销售记录,库存 where 销售记录.商品编号=库存.商品编号"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   DataReport1.Show '显示报表
   Set DataReport1.DataSource = Classprint.rs1
   Case "入库单"
   Classprint.rsDK1 yxsql
   '将语句拉到类模块中执行
   DataReport2.Show '显示报表
   Set DataReport2.DataSource = Classprint.rs1
End Select
Else
MsgBox "查询时关键组成部分不可以出现空格!"
End If
Exit Sub
finish:
MsgBox Err.Description
End Sub

Private Sub XPButton7_Click()
Unload Me
End Sub

⌨️ 快捷键说明

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