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

📄 frmcustomeredit.frm

📁 vb做的数据库 客户管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmCustomerEdit 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "客户基本信息编辑"
   ClientHeight    =   4035
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6420
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   4035
   ScaleWidth      =   6420
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   3015
      Left            =   240
      TabIndex        =   6
      Top             =   120
      Width           =   5895
      Begin VB.TextBox txtCustRequire 
         Height          =   375
         Left            =   1320
         TabIndex        =   16
         Top             =   1620
         Width           =   4275
      End
      Begin MSAdodcLib.Adodc AdoEmps 
         Height          =   330
         Left            =   3960
         Top             =   240
         Visible         =   0   'False
         Width           =   1815
         _ExtentX        =   3201
         _ExtentY        =   582
         ConnectMode     =   0
         CursorLocation  =   3
         IsolationLevel  =   -1
         ConnectionTimeout=   15
         CommandTimeout  =   30
         CursorType      =   3
         LockType        =   3
         CommandType     =   8
         CursorOptions   =   0
         CacheSize       =   50
         MaxRecords      =   0
         BOFAction       =   0
         EOFAction       =   0
         ConnectStringType=   1
         Appearance      =   1
         BackColor       =   -2147483643
         ForeColor       =   -2147483640
         Orientation     =   0
         Enabled         =   -1
         Connect         =   ""
         OLEDBString     =   ""
         OLEDBFile       =   ""
         DataSourceName  =   ""
         OtherAttributes =   ""
         UserName        =   ""
         Password        =   ""
         RecordSource    =   ""
         Caption         =   "AdoEmps"
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         _Version        =   393216
      End
      Begin MSDataListLib.DataCombo dco_CType 
         Height          =   330
         Left            =   1320
         TabIndex        =   13
         Top             =   1140
         Width           =   2175
         _ExtentX        =   3836
         _ExtentY        =   582
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin VB.TextBox txtName 
         Height          =   330
         Left            =   1320
         MaxLength       =   100
         TabIndex        =   0
         Top             =   683
         Width           =   4335
      End
      Begin VB.TextBox txtAddr 
         Height          =   330
         Left            =   1320
         MaxLength       =   200
         TabIndex        =   1
         Top             =   2070
         Width           =   4335
      End
      Begin VB.TextBox txtCode 
         Height          =   270
         Left            =   1320
         MaxLength       =   20
         TabIndex        =   2
         Top             =   2595
         Width           =   1455
      End
      Begin VB.ComboBox ComboArea 
         Height          =   300
         Left            =   1320
         TabIndex        =   5
         Text            =   "Combo1"
         Top             =   180
         Width           =   2415
      End
      Begin MSDataListLib.DataCombo dco_Emps 
         Height          =   315
         Left            =   4200
         TabIndex        =   14
         Top             =   2565
         Width           =   1455
         _ExtentX        =   2566
         _ExtentY        =   582
         _Version        =   393216
         Style           =   2
         Text            =   ""
      End
      Begin VB.Label Label3 
         Caption         =   "客户需求"
         Height          =   315
         Left            =   240
         TabIndex        =   15
         Top             =   1680
         Width           =   915
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "资料员"
         Height          =   180
         Left            =   3360
         TabIndex        =   12
         Top             =   2640
         Width           =   540
      End
      Begin VB.Label Label8 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "客户分类"
         Height          =   180
         Left            =   240
         TabIndex        =   11
         Top             =   1200
         Width           =   720
      End
      Begin VB.Label Label7 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "所属地域"
         Height          =   180
         Left            =   240
         TabIndex        =   10
         Top             =   240
         Width           =   720
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "客户单位"
         Height          =   180
         Left            =   240
         TabIndex        =   9
         Top             =   720
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "通信地址"
         Height          =   180
         Left            =   240
         TabIndex        =   8
         Top             =   2160
         Width           =   720
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "邮政编码"
         Height          =   180
         Left            =   240
         TabIndex        =   7
         Top             =   2640
         Width           =   720
      End
   End
   Begin VB.CommandButton Cmd_OK 
      Caption         =   "确 定"
      Default         =   -1  'True
      Height          =   400
      Left            =   1470
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   3
      Top             =   3360
      Width           =   1300
   End
   Begin VB.CommandButton Cmd_Cancel 
      Cancel          =   -1  'True
      Caption         =   "取 消"
      Height          =   400
      Left            =   3630
      MousePointer    =   99  'Custom
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   3360
      Width           =   1300
   End
   Begin MSAdodcLib.Adodc AdoCType 
      Height          =   375
      Left            =   60
      Top             =   3240
      Visible         =   0   'False
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoCType"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSAdodcLib.Adodc AdoBType 
      Height          =   375
      Left            =   4500
      Top             =   3240
      Visible         =   0   'False
      Width           =   1815
      _ExtentX        =   3201
      _ExtentY        =   661
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "AdoBType"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
End
Attribute VB_Name = "FrmCustomerEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OriCustId As Long   '客户编号

Private Function Check() As Boolean
  If CurArea.AreaId <= 0 Then
    MsgBox "请选择地域"
    Check = False
    Exit Function
  End If
  
  If Trim(txtName) = "" Then
    MsgBox "请输入客户单位名称"
    txtName.SetFocus
    txtName.SelStart = 0
    txtName.SelLength = Lench(Trim(txtName))
    Check = False
    Exit Function
  End If
  
  If Len(Trim(dco_CType.Text)) = 0 Then
    MsgBox "请选择客户类型"
    dco_CType.SetFocus
    Check = False
    Exit Function
  End If
  
  If Trim(txtCustRequire) = "" Then
    MsgBox "输入客户需求"
    txtCustRequire.SetFocus
    txtCustRequiree.SelStart = 0
    txtCustRequire.SelLength = Lench(Trim(txtCustRequire))
    Check = False
    Exit Function
  End If
  If Len(Trim(dco_Emps.Text)) = 0 Then
    MsgBox "请选择客户所属的资料员"
    Check = False
    Exit Function
  End If
  
  Check = True
End Function

Private Sub Cmd_OK_Click()
  If Check = False Then
    Exit Sub
  End If
  '保存客户信息
  With MyCust
    .CustName = MakeStr(txtName)
    .CustTypeId = Val(dco_CType.BoundText)
    .CustRequire = MakeStr(txtCustRequire)
    .Address = MakeStr(txtAddr)
    .Postcode = MakeStr(txtCode)
    .AreaId = CurArea.AreaId
    .EmpId = Val(dco_Emps.BoundText)
  
    If Modify = False Then
      .Insert
    Else
      .Update (OriCustId)
    End If
  End With
  Unload Me
End Sub

Private Sub ComboArea_GotFocus()
  txtName.SetFocus
  '表示可以选择省市县
  frmAreaSel.AreaLevel = 5
  frmAreaSel.Left = Me.Left + ComboArea.Left + 350
  frmAreaSel.Top = Me.Top + ComboArea.Top + ComboArea.Height + 450
  frmAreaSel.Show 1
  '将选择的地域保存在MyArea中
  If frmAreaSel.ClickOK = True Then
    CurArea.GetInfo (CurArea.AreaId)
    ComboArea.Text = MyArea.GetName(CurArea.UpperId) + "  " + CurArea.AreaName
  End If
End Sub

Private Sub Cmd_Cancel_Click()
  Unload Me
End Sub


Private Sub Form_Load()
  DataLoad  '装入客户类型和所属行业
End Sub

Private Sub DataLoad()
  '读取客户类型数据
  AdoCType.ConnectionString = Conn
  AdoCType.RecordSource = "SELECT Id,TypeName FROM Types Where Flag=1"
  AdoCType.Refresh
  Set dco_CType.RowSource = AdoCType
  dco_CType.ListField = "TypeName"
  dco_CType.BoundColumn = "Id"

  '读取销售人员数据数据
  AdoEmps.ConnectionString = Conn
  AdoEmps.RecordSource = "SELECT EmpId,EmpName FROM Employees Order By EmpName"
  AdoEmps.Refresh
  Set dco_Emps.RowSource = AdoEmps
  dco_Emps.ListField = "EmpName"
  dco_Emps.BoundColumn = "EmpId"
End Sub

⌨️ 快捷键说明

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