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

📄 browseorderdialog.frm

📁 VB编写的简单销售管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form BrowseOrderDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "订单浏览"
   ClientHeight    =   3345
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   4485
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3345
   ScaleWidth      =   4485
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   120
      TabIndex        =   17
      Top             =   2880
      Width           =   975
   End
   Begin VB.Frame Frame2 
      Caption         =   "订单信息"
      Height          =   2775
      Left            =   1800
      TabIndex        =   4
      Top             =   0
      Width           =   2655
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   300
         Left            =   1080
         TabIndex        =   19
         Top             =   2400
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   529
         _Version        =   393216
         Enabled         =   0   'False
         Format          =   20119553
         CurrentDate     =   38718
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   300
         Left            =   1080
         TabIndex        =   18
         Top             =   1680
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   529
         _Version        =   393216
         Enabled         =   0   'False
         Format          =   20119553
         CurrentDate     =   38718
      End
      Begin VB.TextBox Text6 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   15
         Top             =   2040
         Width           =   1455
      End
      Begin VB.TextBox Text4 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   12
         Top             =   1320
         Width           =   1455
      End
      Begin VB.TextBox Text3 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   10
         Top             =   960
         Width           =   1455
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   8
         Top             =   600
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   6
         Top             =   240
         Width           =   1455
      End
      Begin VB.Label Label7 
         Caption         =   "交货日期"
         Height          =   255
         Left            =   120
         TabIndex        =   16
         Top             =   2400
         Width           =   735
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "订购数量"
         Height          =   195
         Left            =   120
         TabIndex        =   14
         Top             =   2040
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "产品名"
         Height          =   195
         Left            =   240
         TabIndex        =   13
         Top             =   960
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "订购日期"
         Height          =   195
         Left            =   120
         TabIndex        =   11
         Top             =   1680
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "雇员"
         Height          =   195
         Left            =   360
         TabIndex        =   9
         Top             =   600
         Width           =   360
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "客户单位"
         Height          =   195
         Left            =   120
         TabIndex        =   7
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "订单号"
         Height          =   195
         Left            =   240
         TabIndex        =   5
         Top             =   240
         Width           =   540
      End
   End
   Begin VB.Frame OrderFrame 
      Caption         =   "订单号"
      Height          =   2775
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   1695
      Begin VB.ListBox List1 
         Height          =   2400
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   1455
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   3360
      TabIndex        =   1
      Top             =   2880
      Width           =   975
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   2400
      TabIndex        =   0
      Top             =   2880
      Width           =   975
   End
End
Attribute VB_Name = "BrowseOrderDialog"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim MyDB As Database
Dim MyRecord As Recordset
Dim EmployeeRecord As Recordset
Dim CustomerRecord As Recordset
Dim ProductRecord As Recordset
Dim TempStr As String

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Command2_Click()
    If frmLogin.IsAdmin = False Then
        MsgBox "一般用户不具备删除权限!"
        Exit Sub
    End If
    If List1.ListCount = 0 Then
        MsgBox "请选定一张订单 !"
    Else
        TempStr = "DELETE FROM 订单表 WHERE OrderID = '" & List1.Text & "'"
        MyDB.Execute TempStr
        MsgBox "成功删除订单 " & List1.Text & " !"
        List1.RemoveItem List1.ListIndex
        Text1.Text = ""
        Text2.Text = ""
        Text3.Text = ""
        Text4.Text = ""
        DTPicker1.Value = "2006-1-1"
        Text6.Text = ""
        DTPicker2.Value = "2006-1-1"
    End If
End Sub

Private Sub Form_Load()
    Set MyDB = OpenDatabase(VB.App.Path + "\MySampleDB.mdb", False, False)
    Set MyRecord = MyDB.OpenRecordset("订单表")
    MyRecord.Index = "PrimaryKey"
    Do While Not MyRecord.EOF
        List1.AddItem MyRecord.Fields("OrderID")
        MyRecord.MoveNext
    Loop
End Sub

Private Sub Form_Unload(Cancel As Integer)
    MyRecord.Close
    MyDB.Close
End Sub

Private Sub List1_Click()
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", List1.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + List1.Text + "的订单!"
    Else
        Text1.Text = List1.Text
        DTPicker1.Value = MyRecord.Fields("OrderDate")
        Text6.Text = MyRecord.Fields("OrderAmount")
        DTPicker2.Value = MyRecord.Fields("DeliveryDate")
        Set EmployeeRecord = MyDB.OpenRecordset("select * from 雇员表 where EmployeeID = '" & MyRecord.Fields("EmployeeID") & "'")
        Text2.Text = EmployeeRecord.Fields("Name")
        Set CustomerRecord = MyDB.OpenRecordset("select * from 客户表 where CustomerID = '" & MyRecord.Fields("CustomerID") & "'")
        Text4.Text = CustomerRecord.Fields("CompanyTitle")
        Set ProductRecord = MyDB.OpenRecordset("select * from 产品表 where ProductID = '" & MyRecord.Fields("ProductID") & "'")
        Text3.Text = ProductRecord.Fields("Product")
    End If
End Sub

Private Sub OKButton_Click()
    Unload Me
End Sub

⌨️ 快捷键说明

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