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

📄 frmaddcontract.frm

📁 使用vb开发的课程设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmAddContract 
   Caption         =   "添加合同"
   ClientHeight    =   4305
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   6840
   LinkTopic       =   "Form1"
   ScaleHeight     =   4305
   ScaleWidth      =   6840
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton cmdCancel 
      Caption         =   "返回(&C)"
      Height          =   375
      Left            =   3720
      TabIndex        =   21
      Top             =   3720
      Width           =   1215
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加(&A)"
      Height          =   375
      Left            =   1920
      TabIndex        =   20
      Top             =   3720
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "合同信息"
      Height          =   3375
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6615
      Begin VB.TextBox txtContract 
         Height          =   615
         Index           =   7
         Left            =   1080
         TabIndex        =   24
         Text            =   " "
         Top             =   2640
         Width           =   5295
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   5
         Left            =   4680
         TabIndex        =   22
         Text            =   " "
         Top             =   1440
         Width           =   1215
      End
      Begin VB.TextBox txtContract 
         Height          =   735
         Index           =   6
         Left            =   1080
         MultiLine       =   -1  'True
         TabIndex        =   19
         Top             =   1800
         Width           =   5295
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   4
         Left            =   1080
         TabIndex        =   17
         Text            =   " "
         Top             =   1440
         Width           =   1575
      End
      Begin VB.ComboBox cboSigner 
         Height          =   315
         Left            =   1080
         TabIndex        =   16
         Text            =   "Combo2"
         Top             =   1080
         Width           =   2175
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   3
         Left            =   4800
         TabIndex        =   15
         Text            =   " "
         Top             =   1080
         Width           =   1575
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   2
         Left            =   4800
         TabIndex        =   14
         Text            =   " "
         Top             =   720
         Width           =   1575
      End
      Begin VB.ComboBox cboClient 
         Height          =   315
         Left            =   1080
         TabIndex        =   13
         Text            =   "Combo1"
         Top             =   720
         Width           =   2175
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   1
         Left            =   4800
         TabIndex        =   12
         Text            =   " "
         Top             =   360
         Width           =   1575
      End
      Begin VB.TextBox txtContract 
         Height          =   285
         Index           =   0
         Left            =   1080
         TabIndex        =   11
         Text            =   " "
         Top             =   360
         Width           =   2535
      End
      Begin VB.Label Label12 
         Caption         =   "(元)"
         Height          =   255
         Left            =   5880
         TabIndex        =   23
         Top             =   1440
         Width           =   615
      End
      Begin VB.Label Label11 
         Caption         =   "(元)"
         Height          =   375
         Left            =   2640
         TabIndex        =   18
         Top             =   1440
         Width           =   615
      End
      Begin VB.Label Label10 
         Caption         =   "备注信息:"
         Height          =   255
         Left            =   120
         TabIndex        =   10
         Top             =   2640
         Width           =   1215
      End
      Begin VB.Label Label9 
         Caption         =   "已付合同款:"
         Height          =   255
         Left            =   3600
         TabIndex        =   9
         Top             =   1440
         Width           =   1215
      End
      Begin VB.Label Label8 
         Caption         =   "合同截止日期:"
         Height          =   255
         Left            =   3480
         TabIndex        =   8
         Top             =   1080
         Width           =   1335
      End
      Begin VB.Label Label7 
         Caption         =   "合同生效日期:"
         Height          =   255
         Left            =   3480
         TabIndex        =   7
         Top             =   720
         Width           =   1335
      End
      Begin VB.Label Label6 
         Caption         =   "签  约  人:"
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   1080
         Width           =   975
      End
      Begin VB.Label Label5 
         Caption         =   "合同金额:"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   1440
         Width           =   975
      End
      Begin VB.Label Label4 
         Caption         =   "客户名称:"
         Height          =   255
         Left            =   120
         TabIndex        =   4
         Top             =   720
         Width           =   975
      End
      Begin VB.Label Label3 
         Caption         =   "合同描述:"
         Height          =   255
         Left            =   120
         TabIndex        =   3
         Top             =   1800
         Width           =   1335
      End
      Begin VB.Label Label2 
         Caption         =   "合同编号:"
         Height          =   255
         Left            =   3840
         TabIndex        =   2
         Top             =   360
         Width           =   975
      End
      Begin VB.Label Label1 
         Caption         =   "合同名称:"
         Height          =   255
         Left            =   120
         TabIndex        =   1
         Top             =   360
         Width           =   975
      End
   End
End
Attribute VB_Name = "frmAddContract"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Public sqlStr As String
Public msgText As String

Private Sub cmdAdd_Click()
 Dim rstContract As ADODB.Recordset
 Dim i As Integer
  
 For i = 0 To 5
    If txtContract(i).Text = "" Then
    
       MsgBox "请将信息填写完整", vbOKOnly + vbExclamation, "警告"
 
       Exit Sub
    
    End If
 Next i

 '添加新记录
 sqlStr = "select * from contract"
 Set rstContract = ExecuteSQL(sqlStr, msgText)
 rstContract.AddNew
 rstContract.Fields("contractName") = txtContract(0).Text
 rstContract.Fields("contractNo") = txtContract(1).Text
 rstContract.Fields("startDate") = txtContract(2).Text
 rstContract.Fields("dueDate") = txtContract(3).Text
 rstContract.Fields("amount") = txtContract(4).Text
 rstContract.Fields("Payment") = txtContract(5).Text
 rstContract.Fields("description") = txtContract(6).Text
 rstContract.Fields("memo") = txtContract(7).Text
 rstContract.Fields("clientName") = cboClient.Text
 rstContract.Fields("signer") = cboSigner.Text
 
 rstContract.Update
 rstContract.Close
     
 MsgBox "合同信息添加完成!", vbOKOnly + vbExclamation, "警告"
 
clearTextBox
initClient
initSigner

End Sub

Private Sub cmdCancel_Click()
Unload Me

End Sub

Private Sub Form_Load()
clearTextBox
initClient
initSigner

End Sub

Sub clearTextBox()
Dim i As Integer
For i = 0 To 6
    txtContract(i).Text = ""
Next i
End Sub

Sub initSigner()
'在组合列表框中列出所有员工姓名
Dim rstEmployeeName As ADODB.Recordset

    '从客户表中读取所有员工姓名并添加到组合列表框中
    sqlStr = "select employeeName from employee"
    Set rstEmployeeName = ExecuteSQL(sqlStr, msgText)
    cboSigner.Clear
    
    If Not rstEmployeeName.EOF Then
        
            Do While Not rstEmployeeName.EOF
                cboSigner.AddItem Trim(rstEmployeeName.Fields(0))
                rstEmployeeName.MoveNext
            Loop
        
    Else
        MsgBox "没有找到相关信息,请添加!", vbOKOnly + vbExclamation, "警告"
        
        Exit Sub
    End If
    rstEmployeeName.Close

End Sub

Sub initClient()
'在组合列表框中列出所有客户名称
Dim rstClientName As ADODB.Recordset

    '从客户表中读取所有客户名称并添加到组合列表框中
    sqlStr = "select clientName from client"
    Set rstClientName = ExecuteSQL(sqlStr, msgText)
    cboClient.Clear
    
    If Not rstClientName.EOF Then
        
            Do While Not rstClientName.EOF
                cboClient.AddItem Trim(rstClientName.Fields(0))
                rstClientName.MoveNext
            Loop
        
    Else
        MsgBox "没有找到相关信息,请添加!", vbOKOnly + vbExclamation, "警告"
        
        Exit Sub
    End If
    rstClientName.Close

End Sub

⌨️ 快捷键说明

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