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

📄 frm_gongzi_add.frm

📁 前两年帮人写的毕业设计
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Frm_gongzi_add 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "工资录入"
   ClientHeight    =   3360
   ClientLeft      =   4725
   ClientTop       =   3330
   ClientWidth     =   3195
   Icon            =   "Frm_gongzi_add.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3360
   ScaleWidth      =   3195
   StartUpPosition =   1  '所有者中心
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   375
      Left            =   1860
      TabIndex        =   13
      Top             =   2760
      Width           =   975
   End
   Begin VB.CommandButton Command1 
      Caption         =   "确定"
      Height          =   375
      Left            =   300
      TabIndex        =   12
      Top             =   2760
      Width           =   1035
   End
   Begin VB.TextBox Text4 
      Height          =   300
      Left            =   1260
      TabIndex        =   11
      Top             =   2220
      Width           =   1695
   End
   Begin VB.TextBox Text3 
      Height          =   300
      Left            =   1260
      TabIndex        =   9
      Top             =   1800
      Width           =   1695
   End
   Begin VB.TextBox Text2 
      Height          =   300
      Left            =   1260
      TabIndex        =   7
      Top             =   1380
      Width           =   1695
   End
   Begin VB.TextBox Text1 
      Height          =   300
      Left            =   1260
      TabIndex        =   5
      Top             =   960
      Width           =   1695
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1260
      TabIndex        =   1
      Top             =   120
      Width           =   1695
   End
   Begin VB.Label Label7 
      Caption         =   "扣 款"
      Height          =   315
      Left            =   300
      TabIndex        =   10
      Top             =   2220
      Width           =   555
   End
   Begin VB.Label Label6 
      Caption         =   "奖 金"
      Height          =   255
      Left            =   300
      TabIndex        =   8
      Top             =   1800
      Width           =   555
   End
   Begin VB.Label Label5 
      Caption         =   "技能工资"
      Height          =   195
      Left            =   300
      TabIndex        =   6
      Top             =   1440
      Width           =   795
   End
   Begin VB.Label Label4 
      Caption         =   "基本工资"
      Height          =   255
      Left            =   300
      TabIndex        =   4
      Top             =   1020
      Width           =   735
   End
   Begin VB.Label Label3 
      BackColor       =   &H80000009&
      BorderStyle     =   1  'Fixed Single
      Height          =   300
      Left            =   1260
      TabIndex        =   3
      Top             =   540
      Width           =   1695
   End
   Begin VB.Label Label2 
      Caption         =   "姓 名"
      Height          =   195
      Left            =   300
      TabIndex        =   2
      Top             =   600
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "职工号"
      Height          =   195
      Left            =   300
      TabIndex        =   0
      Top             =   180
      Width           =   675
   End
End
Attribute VB_Name = "Frm_gongzi_add"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select xm from zhigong where zgh='" & Combo1 & "'", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "职工号错误!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Exit Sub
    End If
    Label3.Caption = rst(0)
End Sub

Private Sub Combo1_LostFocus()
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select xm from zhigong where zgh='" & Combo1 & "'", cn, 0, 1
    If rst.BOF And rst.EOF Then
        MsgBox "职工号错误!", vbExclamation, "提示"
        rst.Close
        cn.Close
        Exit Sub
    End If
    Label3.Caption = rst(0)
End Sub

Private Sub Command1_Click()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    If Not (IsNumeric(Text1) And IsNumeric(Text2) And IsNumeric(Text3) And IsNumeric(Text4)) Then
        MsgBox "请正确输入数值!", vbExclamation, "提示"
        Exit Sub
    End If
    Set cn = GetCn
    cn.Execute "insert into gongzi (zgh,xm,jb,jn,jj,kk,sf) values ('" & Combo1 & "','" & Label3.Caption & "'," & Text1 & "," & Text2 & "," & Text3 & "," & Text4 & ", " & Val(Text1) + Val(Text2) + Val(Text3) - Val(Text4) & ")"
    MsgBox "已成功保存!", vbExclamation, "提示"
    Unload Me
    Exit Sub
myerr:
    MsgBox Error, vbExclamation, "提示"
    
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    On Error GoTo myerr
    Dim cn As ADODB.Connection
    Dim rst As New ADODB.Recordset
    Set cn = GetCn
    rst.Open "select zgh from zhigong order by 1", cn, 0, 1
    Combo1.Clear
    Do While Not rst.EOF
        Combo1.AddItem rst(0)
        rst.MoveNext
    Loop
    rst.Close
    cn.Close
    Exit Sub
    
myerr:
    Select Case Err
        Case -2147217904
            If rst.State = 1 Then rst.Close
            rst.Open "select count(*) from zhigong", cn, 0, 1
            If rst(0) = 0 Then
                Exit Sub
            Else
                MsgBox Error, vbExclamation, "提示"
            End If
        Case Else
            MsgBox Error, vbExclamation, "提示"
    End Select
End Sub

⌨️ 快捷键说明

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