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

📄 frmcustomeredit.frm

📁 这是一个利用VB编写的中小企业ERP。功能比较全
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Name            =   "宋体"
            Size            =   15
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   480
         MouseIcon       =   "FrmCustomerEdit.frx":1F06
         TabIndex        =   14
         Top             =   360
         Width           =   1095
      End
   End
   Begin VB.TextBox TxtCustomerName 
      Height          =   375
      Left            =   7560
      TabIndex        =   1
      Top             =   480
      Width           =   3255
   End
   Begin VB.TextBox TxtCustomerID 
      Height          =   375
      Left            =   2040
      TabIndex        =   0
      Top             =   480
      Width           =   3375
   End
   Begin VB.Frame Frame1 
      Caption         =   "购货商送货地信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   2055
      Left            =   480
      TabIndex        =   22
      Top             =   4560
      Width           =   10815
   End
   Begin VB.Label LblDeliverModify 
      BackStyle       =   0  'Transparent
      Caption         =   "修改送货地信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4920
      MouseIcon       =   "FrmCustomerEdit.frx":2210
      MousePointer    =   99  'Custom
      TabIndex        =   25
      Top             =   4200
      Visible         =   0   'False
      Width           =   2415
   End
   Begin VB.Image Image5 
      Height          =   300
      Left            =   4440
      Picture         =   "FrmCustomerEdit.frx":251A
      Top             =   4200
      Visible         =   0   'False
      Width           =   300
   End
   Begin VB.Label LblDeliverDelete 
      BackStyle       =   0  'Transparent
      Caption         =   "删除送货地信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   8160
      MouseIcon       =   "FrmCustomerEdit.frx":2936
      MousePointer    =   99  'Custom
      TabIndex        =   24
      Top             =   4200
      Visible         =   0   'False
      Width           =   2295
   End
   Begin VB.Image Image2 
      Height          =   300
      Left            =   7680
      Picture         =   "FrmCustomerEdit.frx":2C40
      Top             =   4200
      Visible         =   0   'False
      Width           =   300
   End
   Begin VB.Image Image1 
      Height          =   300
      Left            =   1320
      Picture         =   "FrmCustomerEdit.frx":305C
      Top             =   4200
      Width           =   300
   End
   Begin VB.Label LblDeliverAdd 
      BackStyle       =   0  'Transparent
      Caption         =   "添加送货地信息"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   1800
      MouseIcon       =   "FrmCustomerEdit.frx":3478
      MousePointer    =   99  'Custom
      TabIndex        =   23
      Top             =   4200
      Width           =   2415
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "购货商名称"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   5760
      MouseIcon       =   "FrmCustomerEdit.frx":3782
      TabIndex        =   12
      Top             =   480
      Width           =   1935
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "购货商ID"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   15
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      MouseIcon       =   "FrmCustomerEdit.frx":3A8C
      TabIndex        =   11
      Top             =   480
      Width           =   1455
   End
   Begin VB.Image Image4 
      Height          =   300
      Left            =   6720
      Picture         =   "FrmCustomerEdit.frx":3D96
      Top             =   6840
      Width           =   300
   End
   Begin VB.Label LblCancel 
      BackStyle       =   0  'Transparent
      Caption         =   "取 消"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   7320
      MouseIcon       =   "FrmCustomerEdit.frx":41B2
      MousePointer    =   99  'Custom
      TabIndex        =   10
      Top             =   6840
      Width           =   855
   End
   Begin VB.Image Image3 
      Height          =   300
      Left            =   4320
      Picture         =   "FrmCustomerEdit.frx":44BC
      Top             =   6840
      Width           =   300
   End
   Begin VB.Label LblOK 
      BackStyle       =   0  'Transparent
      Caption         =   "确 定"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   4920
      MouseIcon       =   "FrmCustomerEdit.frx":48D8
      MousePointer    =   99  'Custom
      TabIndex        =   9
      Top             =   6840
      Width           =   735
   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 OriCustomerID As String

Private Sub Form_Load()
    If Modify = True Then
        LblDeliverModify.Visible = True
        Image5.Visible = True
        LblDeliverDelete.Visible = True
        Image2.Visible = True
        Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
        Adodc1.RecordSource = "select * from Deliver where CustomerID='" + Trim(OriCustomerID) + "'"
        Set DataGrid1.DataSource = Adodc1
        Refresh_Deliver
    End If
End Sub
Private Sub LblCancel_Click()
    If Modify = False And TxtCustomerID.Enabled = False Then
        MyDeliver.Drop (TxtCustomerID.Text)
    End If
    Unload Me
End Sub
Private Sub LblDeliverAdd_Click()
    If Modify = False Then
        If TxtCustomerID.Text <> "" Then
            
            If MyCustomer.In_DB(TxtCustomerID.Text) = True Then
                MsgBox "购货商代号重复,请重新设置"
                TxtCustomerID.SetFocus
                TxtCustomerID.SelStart = 0
                TxtCustomerID.SelLength = Len(TxtCustomerID)
                Exit Sub
            Else
                FrmDeliverEdit.Modify = False
                FrmDeliverEdit.OriCustomerID = TxtCustomerID.Text
                FrmDeliverEdit.Show 1
                Adodc1.ConnectionString = "driver={SQL Server};server=" + Trim(Server) + ";uid=" + Trim(User) + ";pwd=" + Trim(Password) + ";database=ERP"
                Adodc1.RecordSource = "select * from Deliver where CustomerID='" + Trim(TxtCustomerID.Text) + "'"
                Set DataGrid1.DataSource = Adodc1
            End If
        Else
            MsgBox "请先填写购货商ID"
            TxtCustomerID.SetFocus
            TxtCustomerID.SelStart = 0
            TxtCustomerID.SelLength = Len(TxtCustomerID)
            Exit Sub
        End If
        Refresh_Deliver
    Else
        '修改状态下的添加代码
        FrmDeliverEdit.Modify = False
        FrmDeliverEdit.OriCustomerID = TxtCustomerID.Text
        FrmDeliverEdit.Show 1
        Refresh_Deliver
        
    End If
End Sub

Private Sub LblDeliverDelete_Click()
    Dim TempDeliverID As String
    '保存待删除记录的ID
    TempDeliverID = Adodc1.Recordset.Fields(1)
    '弹出删除确认对话框
    If MsgBox("是否删除“" + Adodc1.Recordset.Fields(1) + "”?", vbYesNo, "确认") = vbYes Then
        MyDeliver.Delete (TempDeliverID)
        MsgBox "删除成功"
    End If
    Refresh_Deliver
End Sub

Private Sub LblDeliverModify_Click()
    FrmDeliverEdit.Modify = True
    FrmDeliverEdit.OriCustomerID = TxtCustomerID.Text
    FrmDeliverEdit.OriDeliverID = Trim(Adodc1.Recordset.Fields(1))
    
    '填充DeliverEdit窗口
    FrmDeliverEdit.TxtDeliveID = Trim(Adodc1.Recordset.Fields(1))
    FrmDeliverEdit.TxtDeliveID.Enabled = False
    FrmDeliverEdit.TxtCountry = Trim(Adodc1.Recordset.Fields(2))
    FrmDeliverEdit.TxtProvince = Trim(Adodc1.Recordset.Fields(3))
    FrmDeliverEdit.TxtCity = Trim(Adodc1.Recordset.Fields(4))
    FrmDeliverEdit.TxtAddress = Trim(Adodc1.Recordset.Fields(5))
    FrmDeliverEdit.TxtLinkman = Trim(Adodc1.Recordset.Fields(6))
    FrmDeliverEdit.TxtTelephone = Trim(Adodc1.Recordset.Fields(7))
    FrmDeliverEdit.TxtFax = Trim(Adodc1.Recordset.Fields(8))
    
    FrmDeliverEdit.Show 1
    Refresh_Deliver
End Sub

Private Sub LblOK_Click()
    
    '判断要编辑信息是否完整
    If Check = False Then
        Exit Sub
    End If
    
    With MyCustomer
        .CustomerID = TxtCustomerID.Text
        .CustomerName = TxtCustomerName.Text
        .Country = TxtCountry.Text
        .Province = TxtProvince.Text
        .City = TxtCity.Text
        .Address = TxtAddress.Text
        .Linkman = TxtLinkman.Text
        .Telephone = TxtTelephone.Text
        .Fax = TxtFax.Text
        
        '判断操作是添加还是修改
        If Modify = False Then '判断为添加操作
            
            '判断销售员ID是否已经存在
            If .In_DB(TxtCustomerID.Text) = True Then
                MsgBox "购货商代号重复,请重新设置"
                TxtCustomerID.SetFocus
                TxtCustomerID.SelStart = 0
                TxtCustomerID.SelLength = Len(TxtCustomerID)
                Exit Sub
            Else
                .Insert '添加
                MsgBox "添加成功"
            End If
        Else '判断为修改操作
            .Update (OriCustomerID)
            MsgBox "修改成功"
        End If
    End With
    Unload Me
    FrmCustomer.Adodc1.Refresh
End Sub


Private Function Check() As Boolean
    If Trim(TxtCustomerID) = "" Then
        MsgBox "请输入购货商代号"
        TxtSalesmanID.SetFocus
        Check = False
        Exit Function
    End If
    If Trim(TxtCustomerName) = "" Then
        MsgBox "请输入购货商名称"
        TxtCustomerName.SetFocus
        Check = False
        Exit Function
    End If
    Check = True
End Function
Private Sub Refresh_Deliver()
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount = 0 Then
        LblDeliverModify.Enabled = False
        LblDeliverDelete.Enabled = False
    Else
        LblDeliverModify.Enabled = True
        LblDeliverDelete.Enabled = True
    End If
End Sub
Private Sub TxtFax_KeyPress(KeyAscii As Integer)
    EnterTAB (KeyAscii)
    If In_Single(KeyAscii) = False Then
        KeyAscii = 0
    End If
End Sub

Private Sub TxtTelephone_KeyPress(KeyAscii As Integer)
    EnterTAB (KeyAscii)
    If In_Single(KeyAscii) = False Then
        KeyAscii = 0
    End If
End Sub

⌨️ 快捷键说明

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