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

📄 browseproductdialog.frm

📁 商品销售管理系统,用Accsee作为数据库,VB编程,可直接运行,用以作为课程设计足以!
💻 FRM
字号:
VERSION 5.00
Begin VB.Form BrowseProductDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "产品浏览"
   ClientHeight    =   2715
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6270
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   2715
   ScaleWidth      =   6270
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton OKButton 
      Caption         =   "确定"
      Height          =   375
      Left            =   4080
      TabIndex        =   18
      Top             =   2040
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   2640
      TabIndex        =   17
      Top             =   2040
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   1560
      TabIndex        =   16
      Top             =   2040
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "产品信息"
      Height          =   1335
      Left            =   1560
      TabIndex        =   3
      Top             =   0
      Width           =   4695
      Begin VB.TextBox Text6 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   15
         Top             =   960
         Width           =   1575
      End
      Begin VB.TextBox Text5 
         Enabled         =   0   'False
         Height          =   285
         Left            =   960
         TabIndex        =   13
         Top             =   960
         Width           =   1095
      End
      Begin VB.TextBox Text4 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   11
         Top             =   600
         Width           =   1575
      End
      Begin VB.TextBox Text3 
         Enabled         =   0   'False
         Height          =   285
         Left            =   960
         TabIndex        =   9
         Top             =   600
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   7
         Top             =   240
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   285
         Left            =   960
         TabIndex        =   5
         Top             =   240
         Width           =   1095
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "单价"
         Height          =   195
         Left            =   2400
         TabIndex        =   14
         Top             =   960
         Width           =   360
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "库存量"
         Height          =   195
         Left            =   240
         TabIndex        =   12
         Top             =   960
         Width           =   540
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "产品类别"
         Height          =   195
         Left            =   2160
         TabIndex        =   10
         Top             =   600
         Width           =   720
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "产品说明"
         Height          =   195
         Left            =   120
         TabIndex        =   8
         Top             =   600
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "产品编号"
         Height          =   195
         Left            =   2160
         TabIndex        =   6
         Top             =   240
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "产品名称"
         Height          =   195
         Left            =   120
         TabIndex        =   4
         Top             =   240
         Width           =   720
      End
   End
   Begin VB.Frame ProductFrame 
      Caption         =   "产品编号"
      Height          =   2535
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   1455
      Begin VB.ListBox List1 
         Height          =   3120
         Left            =   120
         TabIndex        =   2
         Top             =   240
         Width           =   1215
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   5160
      TabIndex        =   0
      Top             =   2040
      Width           =   975
   End
End
Attribute VB_Name = "BrowseProductDialog"
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 TempStr As String

Private Sub CancelButton_Click()
    Unload Me
End Sub

Private Sub Command1_Click()
    If frmLogin.IsAdmin = False Then
        MsgBox "一般用户不具备修改权限!"
        Exit Sub
    End If
    If List1.SelCount = 0 Then
        MsgBox "请选定一种产品 !"
        Exit Sub
    End If
    Text1.Enabled = True
    Text3.Enabled = True
    Text4.Enabled = True
    Text5.Enabled = True
    Text6.Enabled = True
    Command1.Enabled = False
    Command2.Enabled = False
End Sub

Private Sub Command2_Click()
Dim sure As Integer
sure = MsgBox("确定删除?", vbYesNo)
If sure = vbYes Then
    TempStr = "DELETE FROM 产品表 WHERE ProductID='" & Text2.Text & "'"
    MyDB.Execute TempStr
    MsgBox "成功删除产品 " & Text2.Text & " !"
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text4.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    List1.RemoveItem List1.ListIndex
   
 Else
    Exit Sub
 End If
End Sub

Private Sub Data1_Reposition()
    If Not (Data1.Recordset.EOF And Data1.Recordset.BOF) Then
        Data2.DatabaseName = VB.App.Path + "\MySampleDB.mdb"
        Data2.RecordSource = "select * from 客户表 where CustomerID='" & Data1.Recordset("CustomerID") & "'"
        Data2.Refresh
        Data3.DatabaseName = VB.App.Path + "\MySampleDB.mdb"
            Data3.RecordSource = "select * from 雇员表 where EmployeeID='" & Data1.Recordset("EmployeeID") & "'"
        Data3.Refresh
    Else
        Text8.Text = ""
        Text9.Text = ""
    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("ProductID")
        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 = MyRecord.Fields("Product")
        Text2.Text = List1.Text
        Text3.Text = MyRecord.Fields("Statement")
        Text4.Text = MyRecord.Fields("Category")
        Text5.Text = MyRecord.Fields("Quantity")
        Text6.Text = MyRecord.Fields("PerPrice")
     End If
    
End Sub

Private Sub OKButton_Click()
    If Command1.Enabled = True Then
        Unload Me
    Else
        If Text1.Text = "" Then
            MsgBox "请输入 产品名称 !"
            Exit Sub
        End If
        If Text3.Text = "" Then
            MsgBox "请输入 产品说明 !"
            Exit Sub
        End If
        If Text4.Text = "" Then
            MsgBox "请输入 产品类别 !"
            Exit Sub
        End If
        If Text5.Text = "" Then
            MsgBox "请输入 库存量 !"
            Exit Sub
        End If
        If Not IsNumeric(Text5.Text) Then
            MsgBox "库存量 请输入 数字 !"
            Exit Sub
        End If
        If Text6.Text = "" Then
            MsgBox "请输入 单价 !"
            Exit Sub
        End If
        If Not IsNumeric(Text6.Text) Then
            MsgBox "单价 请输入 数字 !"
            Exit Sub
        End If
                
        TempStr = "UPDATE 产品表 SET Product='" & Text1.Text & "',Statement='" & Text3.Text & _
                        "',Category='" & Text4.Text & "',Quantity=" & Val(Text5.Text) & ",PerPrice=" _
                        & Val(Text6.Text) & " WHERE ProductID='" & Text2.Text & "'"
        MyDB.Execute TempStr
        MsgBox "成功修改客户" & Text2.Text & "!"
        Text1.Enabled = False
        Text3.Enabled = False
        Text4.Enabled = False
        Text5.Enabled = False
        Text6.Enabled = False
        Command1.Enabled = True
        
    End If
End Sub

⌨️ 快捷键说明

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