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

📄 browsecustomerdialog.frm

📁 商品销售管理系统,用Accsee作为数据库,VB编程,可直接运行,用以作为课程设计足以!
💻 FRM
字号:
VERSION 5.00
Begin VB.Form BrowseCustomerDialog 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "客户浏览"
   ClientHeight    =   4230
   ClientLeft      =   2760
   ClientTop       =   3750
   ClientWidth     =   6375
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4230
   ScaleWidth      =   6375
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   2760
      TabIndex        =   22
      Top             =   3120
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   1680
      TabIndex        =   21
      Top             =   3120
      Width           =   975
   End
   Begin VB.Frame Frame1 
      Caption         =   "客户信息"
      Height          =   2655
      Left            =   1680
      TabIndex        =   4
      Top             =   0
      Width           =   4695
      Begin VB.TextBox Text14 
         Enabled         =   0   'False
         Height          =   855
         Left            =   600
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   20
         Top             =   1680
         Width           =   3975
      End
      Begin VB.TextBox Text13 
         Enabled         =   0   'False
         Height          =   285
         Left            =   1080
         TabIndex        =   18
         Top             =   1320
         Width           =   3495
      End
      Begin VB.TextBox Text6 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   16
         Top             =   960
         Width           =   1575
      End
      Begin VB.TextBox Text5 
         Enabled         =   0   'False
         Height          =   285
         Left            =   720
         TabIndex        =   14
         Top             =   960
         Width           =   1215
      End
      Begin VB.TextBox Text4 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   12
         Top             =   600
         Width           =   1575
      End
      Begin VB.TextBox Text3 
         Enabled         =   0   'False
         Height          =   285
         Left            =   840
         TabIndex        =   10
         Top             =   600
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Enabled         =   0   'False
         Height          =   285
         Left            =   3000
         TabIndex        =   8
         Top             =   240
         Width           =   1575
      End
      Begin VB.TextBox Text1 
         Enabled         =   0   'False
         Height          =   285
         Left            =   720
         TabIndex        =   6
         Top             =   240
         Width           =   1215
      End
      Begin VB.Label Label14 
         AutoSize        =   -1  'True
         Caption         =   "备注"
         Height          =   195
         Left            =   120
         TabIndex        =   19
         Top             =   2040
         Width           =   360
      End
      Begin VB.Label Label13 
         AutoSize        =   -1  'True
         Caption         =   "单位地址"
         Height          =   195
         Left            =   120
         TabIndex        =   17
         Top             =   1320
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         Caption         =   "传真"
         Height          =   195
         Left            =   2400
         TabIndex        =   15
         Top             =   960
         Width           =   360
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         Caption         =   "邮编"
         Height          =   195
         Left            =   120
         TabIndex        =   13
         Top             =   960
         Width           =   360
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         Caption         =   "电话"
         Height          =   195
         Left            =   2400
         TabIndex        =   11
         Top             =   600
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         Caption         =   "联系人"
         Height          =   195
         Left            =   120
         TabIndex        =   9
         Top             =   600
         Width           =   540
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         Caption         =   "编号"
         Height          =   195
         Left            =   2400
         TabIndex        =   7
         Top             =   240
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "单位"
         Height          =   195
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   360
      End
   End
   Begin VB.Frame CustomerFrame 
      Caption         =   "客户编号"
      Height          =   3735
      Left            =   0
      TabIndex        =   2
      Top             =   0
      Width           =   1575
      Begin VB.ListBox List1 
         Height          =   4380
         Left            =   120
         TabIndex        =   3
         Top             =   240
         Width           =   1335
      End
   End
   Begin VB.CommandButton CancelButton 
      Caption         =   "取消"
      Height          =   375
      Left            =   5280
      TabIndex        =   1
      Top             =   3120
      Width           =   975
   End
   Begin VB.CommandButton OKButton 
      Caption         =   "确认"
      Height          =   375
      Left            =   4200
      TabIndex        =   0
      Top             =   3120
      Width           =   975
   End
End
Attribute VB_Name = "BrowseCustomerDialog"
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
    Text13.Enabled = True
    Text14.Enabled = True
    Command1.Enabled = False
    
End Sub

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


Private Sub Form_Load()
    Command2.Enabled = True
    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("CustomerID")
        MyRecord.MoveNext
    Loop
End Sub

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

Private Sub List1_Click()
    Command1.Enabled = True
    MyRecord.Index = "PrimaryKey"
    MyRecord.Seek "=", List1.Text
    If MyRecord.NoMatch Then
        MsgBox "没有编号为" + List1.Text + "的客户!"
    Else
        Text1.Text = MyRecord.Fields("CompanyTitle")
        Text2.Text = List1.Text
        Text3.Text = MyRecord.Fields("LinkMan")
        Text4.Text = MyRecord.Fields("Phone")
        Text5.Text = MyRecord.Fields("PostCode")
        Text6.Text = MyRecord.Fields("Fax")
        Text13.Text = MyRecord.Fields("Address")
        If Not IsNull(MyRecord.Fields("Memo")) Then
            Text14.Text = MyRecord.Fields("Memo")
        Else
            Text14.Text = ""
        End If
        
    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 Text6.Text = "" Then
            MsgBox "请输入 传真 !"
            Exit Sub
        End If
        If Text13.Text = "" Then
            MsgBox "请输入 单位地址 !"
            Exit Sub
        End If
                
        TempStr = "UPDATE 客户表 SET CompanyTitle='" & Text1.Text & "',LinkMan='" & Text3.Text & _
                        "',Phone='" & Text4.Text & "',PostCode='" & Text5.Text & "',Fax='" _
                        & Text6.Text & "',Memo='" & Text14.Text & "',Address='" & Text13.Text & _
                        "' WHERE CustomerID='" & Text2.Text & "'"
        MyDB.Execute TempStr
        MsgBox "成功修改客户" & Text2.Text & "!"
        Text1.Enabled = False
        Text3.Enabled = False
        Text4.Enabled = False
        Text5.Enabled = False
        Text6.Enabled = False
        Text13.Enabled = False
        Text14.Enabled = False
        Command1.Enabled = True
        
    End If
End Sub

⌨️ 快捷键说明

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