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

📄 frmcustomer1.frm

📁 一个贸易公司的管理信息系统 我的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmCustomer1 
   Caption         =   "顾客信息"
   ClientHeight    =   4716
   ClientLeft      =   48
   ClientTop       =   348
   ClientWidth     =   7560
   LinkTopic       =   "Form1"
   ScaleHeight     =   4716
   ScaleWidth      =   7560
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存 (&S)"
      Height          =   375
      Left            =   2040
      TabIndex        =   10
      Top             =   4080
      Width           =   1215
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "返回 (&X)"
      Height          =   375
      Left            =   3960
      TabIndex        =   12
      Top             =   4080
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "顾客信息"
      Height          =   2412
      Index           =   0
      Left            =   120
      TabIndex        =   14
      Top             =   120
      Width           =   7212
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   8
         Left            =   4560
         MaxLength       =   40
         TabIndex        =   8
         Top             =   1560
         Width           =   2412
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   0
         Left            =   1200
         MaxLength       =   40
         TabIndex        =   0
         Top             =   480
         Width           =   2292
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   1
         Left            =   1200
         MaxLength       =   30
         TabIndex        =   1
         Top             =   840
         Width           =   2292
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   2
         Left            =   1200
         MaxLength       =   40
         TabIndex        =   2
         Top             =   1200
         Width           =   2292
      End
      Begin VB.TextBox txtItem 
         Height          =   276
         Index           =   3
         Left            =   1200
         MaxLength       =   15
         TabIndex        =   3
         Top             =   1560
         Width           =   2292
      End
      Begin VB.TextBox txtItem 
         Height          =   276
         Index           =   4
         Left            =   1200
         MaxLength       =   15
         TabIndex        =   4
         Top             =   1920
         Width           =   2292
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   5
         Left            =   4560
         MaxLength       =   6
         TabIndex        =   5
         Top             =   480
         Width           =   2412
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   6
         Left            =   4560
         MaxLength       =   20
         TabIndex        =   6
         Top             =   840
         Width           =   2412
      End
      Begin VB.TextBox txtItem 
         Height          =   270
         Index           =   7
         Left            =   4560
         MaxLength       =   20
         TabIndex        =   7
         Top             =   1200
         Width           =   2412
      End
      Begin VB.Label Label2 
         Caption         =   "联系人姓名:"
         Height          =   252
         Index           =   16
         Left            =   240
         TabIndex        =   23
         Top             =   840
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "公司名称:"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   22
         Top             =   480
         Width           =   975
      End
      Begin VB.Label Label2 
         Caption         =   "城市名称:"
         Height          =   252
         Index           =   3
         Left            =   240
         TabIndex        =   21
         Top             =   1560
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "联系地址:"
         Height          =   252
         Index           =   1
         Left            =   240
         TabIndex        =   20
         Top             =   1200
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "地区名称:"
         Height          =   252
         Index           =   7
         Left            =   240
         TabIndex        =   19
         Top             =   1920
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "邮政编码:"
         Height          =   252
         Index           =   4
         Left            =   3720
         TabIndex        =   18
         Top             =   480
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "联系电话:"
         Height          =   252
         Index           =   13
         Left            =   3720
         TabIndex        =   17
         Top             =   840
         Width           =   1092
      End
      Begin VB.Label Label2 
         Caption         =   "传真号码:"
         Height          =   252
         Index           =   14
         Left            =   3720
         TabIndex        =   16
         Top             =   1200
         Width           =   972
      End
      Begin VB.Label Label2 
         Caption         =   "公司主页:"
         Height          =   252
         Index           =   2
         Left            =   3720
         TabIndex        =   15
         Top             =   1560
         Width           =   972
      End
   End
   Begin VB.Frame Frame3 
      Caption         =   "备注信息"
      Height          =   1215
      Left            =   120
      TabIndex        =   13
      Top             =   2640
      Width           =   7212
      Begin VB.TextBox txtItem 
         Height          =   840
         Index           =   9
         Left            =   120
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   9
         Top             =   240
         Width           =   6852
      End
   End
   Begin VB.TextBox txtNo 
      Height          =   270
      Left            =   480
      TabIndex        =   11
      TabStop         =   0   'False
      Top             =   4080
      Visible         =   0   'False
      Width           =   735
   End
End
Attribute VB_Name = "frmCustomer1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'是否改动过记录,ture为改过
Dim mblChange As Boolean
Public txtSQL As String


Private Sub cboItem_Change(Index As Integer)
    '有变化设置gblchange
    mblChange = True
End Sub


Private Sub cboItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
    EnterToTab KeyCode
    
End Sub

Private Sub cmdExit_Click()
    If mblChange And cmdSave.Enabled Then
        If MsgBox("保存当前记录的变化吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
            '保存
            Call cmdSave_Click
        End If
    End If
    Unload Me
End Sub

Private Sub cmdSave_Click()
    Dim intCount As Integer
    Dim sMeg As String
    Dim mrc As ADODB.Recordset
    Dim MsgText As String
    
    For intCount = 0 To 8
        If Trim(txtItem(intCount) & " ") = "" Then
            Select Case intCount
                Case 0
                    sMeg = "公司名称"
                Case 1
                    sMeg = "联系人姓名"
                Case 2
                    sMeg = "联系地址"
                Case 3
                    sMeg = "城市名称"
                Case 4
                    sMeg = "地区名称"
                Case 5
                    sMeg = "邮政编码"
                Case 6
                    sMeg = "联系电话"
                Case 7
                    sMeg = "传真号码"
                Case 8
                    sMeg = "公司主页"
            End Select
            sMeg = sMeg & "不能为空!"
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
            txtItem(intCount).SetFocus
        
            Exit Sub
        End If
    Next intCount
    
    If Not IsNumeric(Trim(txtItem(6))) Then
        MsgBox "联系电话请输入数字!", vbOKOnly + vbExclamation, "警告"
        txtItem(6).SetFocus
        Exit Sub
    End If
   
    
    If gintCmode = 1 Then
        txtSQL = "select * from customers where CompanyName ='" & Trim(txtItem(0)) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
            MsgBox "已经存在此公司的记录!", vbOKOnly + vbExclamation, "警告"
            txtItem(0).SetFocus
            Exit Sub
        End If
        mrc.Close
    End If
    
    
    If gintCmode = 2 Then
        '先删除已有记录
        txtSQL = "delete from customers where CustomerID ='" & Trim(txtNo) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
    End If
    
    '再加入新记录
    txtSQL = "select * from customers "
    Set mrc = ExecuteSQL(txtSQL, MsgText)
    mrc.AddNew
    
    mrc.Fields(0) = txtNo
    For intCount = 0 To 9
        mrc.Fields(intCount + 1) = Trim(txtItem(intCount))
    Next intCount
    
    mrc.Update
    mrc.Close
   
    
        
    If gintCmode = 1 Then
        For intCount = 0 To 9
            txtItem(intCount) = ""
        Next intCount
        
        mblChange = False
        MsgBox "添加供应商信息成功!", vbOKOnly + vbExclamation, "添加供应商信息"
        
        Unload Me
        If flagCedit Then
            Unload frmCustomer
            frmCustomer.txtSQL = "select * from customers"
            frmCustomer.Show
        End If
        
    ElseIf gintCmode = 2 Then
        Unload Me
        If flagCedit Then
            Unload frmCustomer
        End If
        frmCustomer.txtSQL = "select * from customers"
        frmCustomer.Show
        
    End If
    
End Sub

Private Sub Form_Load()
    Dim sSql As String
    Dim intCount As Integer
    Dim MsgText As String
    Dim mrcc As ADODB.Recordset
    
    
   
    If gintCmode = 1 Then
        Me.Caption = Me.Caption & "添加"
        txtNo = GetRkno()
    ElseIf gintCmode = 2 Then
       
        
        
        Set mrcc = ExecuteSQL(txtSQL, MsgText)
        
        If mrcc.EOF = False Then
            With mrcc
                
                txtNo = mrcc.Fields(0)
                                
                For intCount = 0 To 9
                    If Not IsNull(.Fields(intCount + 1)) Then
                        txtItem(intCount) = .Fields(intCount + 1)
                    End If
                Next intCount
                                
            End With
            
        End If
        mrcc.Close
        Me.Caption = Me.Caption & "修改"
            
        
    End If
    
    mblChange = False
    
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    gintCmode = 0
End Sub





Private Sub txtItem_Change(Index As Integer)
    '有变化设置gblchange
    mblChange = True
    
    
End Sub


Private Sub txtItem_GotFocus(Index As Integer)
    txtItem(Index).SelStart = 0
    txtItem(Index).SelLength = Len(txtItem(Index))
    
End Sub

Private Sub txtItem_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
        EnterToTab KeyCode

End Sub





⌨️ 快捷键说明

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