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

📄 frmbasicclientsubinfo.frm

📁 企业ERP系统 采用VB+SQL2000实现。 有客户合约
💻 FRM
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Begin VB.Form frmBasicClientSubInfo 
   Caption         =   "客户信息"
   ClientHeight    =   4905
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7500
   LinkTopic       =   "Form1"
   ScaleHeight     =   4905
   ScaleWidth      =   7500
   StartUpPosition =   3  'Windows Default
   Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21 
      Height          =   4905
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   7500
      _LayoutVersion  =   1
      _ExtentX        =   13229
      _ExtentY        =   8652
      _DataPath       =   ""
      Bands           =   "frmBasicClientsubInfo.frx":0000
      Begin VB.Frame Frame1 
         Height          =   4335
         Left            =   60
         TabIndex        =   1
         Top             =   480
         Width           =   7275
         Begin VB.TextBox txtUpdateDate 
            BackColor       =   &H8000000F&
            Enabled         =   0   'False
            Height          =   315
            Left            =   4980
            TabIndex        =   12
            Top             =   3240
            Width           =   1995
         End
         Begin VB.TextBox txtUpdateOperator 
            Height          =   315
            Left            =   1200
            MaxLength       =   20
            TabIndex        =   11
            Top             =   3240
            Width           =   1995
         End
         Begin VB.TextBox txtClientAllName 
            BackColor       =   &H00C0C0FF&
            Height          =   315
            Left            =   1200
            MaxLength       =   20
            TabIndex        =   10
            Top             =   240
            Width           =   5775
         End
         Begin VB.CommandButton cmdOk 
            Caption         =   "確定 &A"
            Height          =   315
            Left            =   2040
            TabIndex        =   9
            Top             =   3840
            Width           =   735
         End
         Begin VB.CommandButton cmdClose 
            Caption         =   "關閉 &C"
            Height          =   315
            Left            =   4380
            TabIndex        =   8
            Top             =   3840
            Width           =   735
         End
         Begin VB.TextBox txtClient 
            BackColor       =   &H00FFFFFF&
            Height          =   315
            Left            =   1200
            MaxLength       =   20
            TabIndex        =   7
            Top             =   720
            Width           =   1935
         End
         Begin VB.TextBox txtTel 
            Height          =   315
            Left            =   5040
            TabIndex        =   6
            Top             =   720
            Width           =   1935
         End
         Begin VB.TextBox txtFax 
            Height          =   315
            Left            =   1200
            TabIndex        =   5
            Top             =   1200
            Width           =   1935
         End
         Begin VB.TextBox txtAddress 
            Height          =   315
            Left            =   5040
            TabIndex        =   4
            Top             =   1260
            Width           =   1935
         End
         Begin VB.TextBox txtSurCharge 
            Height          =   315
            Left            =   1200
            TabIndex        =   3
            Top             =   1680
            Width           =   1935
         End
         Begin VB.TextBox txtRemark 
            Height          =   915
            Left            =   1200
            MultiLine       =   -1  'True
            ScrollBars      =   3  'Both
            TabIndex        =   2
            Top             =   2160
            Width           =   5775
         End
         Begin VB.Label Label4 
            Caption         =   "填写日期"
            Height          =   315
            Left            =   3960
            TabIndex        =   21
            Top             =   3240
            Width           =   915
         End
         Begin VB.Label Label2 
            Caption         =   "填写人"
            Height          =   315
            Left            =   240
            TabIndex        =   20
            Top             =   3240
            Width           =   915
         End
         Begin VB.Label Label1 
            Caption         =   "客戶全稱"
            Height          =   255
            Left            =   240
            TabIndex        =   19
            Top             =   300
            Width           =   855
         End
         Begin VB.Label Label3 
            Caption         =   "客戶簡稱"
            Height          =   255
            Index           =   4
            Left            =   240
            TabIndex        =   18
            Top             =   720
            Width           =   915
         End
         Begin VB.Label Label5 
            Caption         =   "電話"
            Height          =   255
            Left            =   3720
            TabIndex        =   17
            Top             =   720
            Width           =   675
         End
         Begin VB.Label Label6 
            Caption         =   "傳真"
            Height          =   255
            Left            =   240
            TabIndex        =   16
            Top             =   1200
            Width           =   735
         End
         Begin VB.Label Label7 
            Caption         =   "地址"
            Height          =   255
            Left            =   3720
            TabIndex        =   15
            Top             =   1200
            Width           =   915
         End
         Begin VB.Label Label8 
            Caption         =   "付加費"
            Height          =   255
            Left            =   240
            TabIndex        =   14
            Top             =   1680
            Width           =   855
         End
         Begin VB.Label Label9 
            Caption         =   "備注"
            Height          =   255
            Left            =   240
            TabIndex        =   13
            Top             =   2160
            Width           =   795
         End
      End
   End
End
Attribute VB_Name = "frmBasicClientSubInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public newItem As Boolean 'true表示增加
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
    Select Case Tool.Name
            Case "cmdSave":
                 Save newItem
           Case "cmdCancel":
                Unload Me
    End Select
End Sub

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdOk_Click()
    Save newItem
End Sub

Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
    InitTitle
End Sub
Private Sub InitTitle()
    Label1.Caption = "客戶全稱"
    Label2.Caption = "填寫人"
    Label3.item(4).Caption = "客戶簡稱"
    Label5.Caption = "電話"
    Label6.Caption = "傳真"
    Label7.Caption = "地址"
    Label8.Caption = "付加費"
    Label9.Caption = "備註"
    Label4.Caption = "填寫日期"
    cmdOk.Caption = "確定 &O"
    cmdClose.Caption = "關閉 &C"
    Me.Caption = "客戶信息"
End Sub

Public Sub InitInfo(strId As String)
If newItem = False Then
    Dim rs As ADODB.Recordset
     ' On Error GoTo errLabel
      Set rs = New ADODB.Recordset
      With rs
        .CursorLocation = adUseClient
        .CursorType = adOpenDynamic
        .LockType = adLockOptimistic
        Set .ActiveConnection = Cn
      End With
      Dim strSql As String
      strSql = "select * from tBasicClientInfo where status=0 and ClientAllName='" & strId & "'"
       rs.Open strSql
        If Not rs.EOF Then
            txtClientAllName = NullValue(rs.Fields!ClientAllname)
            txtClientAllName.Enabled = False
            txtClient = NullValue(rs.Fields!Client)
            txtTel = NullValue(rs.Fields!Tel)
            txtFax = NullValue(rs.Fields!Fax)
            txtAddress = NullValue(rs.Fields!Address)
            txtSurCharge = NullValue(rs.Fields!SurCharge)
            txtRemark = NullValue(rs.Fields!Remark)
            txtUpdateOperator = NullValue(rs.Fields!UpdateOperator)
            txtUpdateDate = NullValue(rs.Fields!UpdateDate)
        End If
      rs.Close
      Set rs = Nothing
      SystemExecuteEnd Me
End If
Exit Sub
errLabel:
    SystemExecuteEnd Me
    objDatabase.DatabaseError
End Sub
Private Sub Save(Optional blModi As Boolean)
    Dim strSql As String
    Dim rs As ADODB.Recordset
    On Error GoTo errHandle
    Set rs = New ADODB.Recordset
    With rs
      .CursorLocation = adUseClient
      .CursorType = adOpenDynamic
      .LockType = adLockOptimistic
      Set .ActiveConnection = Cn
    End With
    If txtClientAllName.Text = "" Then
        MsgBox "客戶全稱不能為空!", vbCritical, "提示"
        txtClientAllName.SetFocus
        Exit Sub
    End If
    If blModi Then
        strSql = "select * from tBasicClientInfo where status=0 and ClientAllName='" & txtClientAllName & "'"
        rs.Open strSql
        If Not rs.EOF Then
            MsgBox "此顏色信息已存在!", vbCritical, "提示"
            txtClientAllName.Text = ""
            txtClientAllName.SetFocus
            rs.Close
            Set rs = Nothing
            Exit Sub
        End If
        If MsgBox("是否添加新的信息?", vbQuestion + vbYesNo, "询问") = vbNo Then
            rs.Close
            Set rs = Nothing
            Exit Sub
        End If
                
        rs.AddNew '新建
        rs.Fields!ClientAllname = Trim$(txtClientAllName)
        rs.Fields!Client = Trim$(txtClient)
        rs.Fields!Tel = Trim$(txtTel)
        rs.Fields!Fax = Trim$(txtFax)
        rs.Fields!Address = Trim$(txtAddress)
        rs.Fields!SurCharge = Trim$(txtSurCharge)
        rs.Fields!Remark = Trim$(txtRemark)
        rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
        rs.Fields!UpdateDate = Now
        rs.Update
        MsgBox "新建成功!", vbInformation, "恭喜'"
    Else
        strSql = "select * from tBasicClientInfo where status=0 and ClientAllname='" & txtClientAllName & "'"
        rs.Open strSql
        If rs.EOF Then '修改
            MsgBox "没有可修改的记录!", vbExclamation, "修改"
            rs.Close
            Set rs = Nothing
            txtClientAllName.SetFocus
            Exit Sub
        End If
        If MsgBox("是否修改记录?", vbYesNo + vbQuestion, "修改") = vbNo Then
            rs.Close
            Set rs = Nothing
            Exit Sub
        End If
        rs.Fields!ClientAllname = Trim$(txtClientAllName)
        rs.Fields!Client = Trim$(txtClient)
        rs.Fields!Tel = Trim$(txtTel)
        rs.Fields!Fax = Trim$(txtFax)
        rs.Fields!Address = Trim$(txtAddress)
        rs.Fields!SurCharge = Trim$(txtSurCharge)
        rs.Fields!Remark = Trim$(txtRemark)
        rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
        rs.Fields!UpdateDate = Now
        rs.Update
        MsgBox "修改成功!", vbInformation, "恭喜"
    End If
    rs.Close
    Set rs = Nothing
    txtClientAllName.Enabled = True
    frmBasicClientInfo.FillMshf1 ("select * from tBasicClientInfo where status=0")
    Unload Me
    Exit Sub
    
errHandle:
    Set rs = Nothing
    objDatabase.DatabaseError
End Sub







⌨️ 快捷键说明

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