www.pudn.com > renshixitong.rar > frmManRecord1.frm


VERSION 5.00 
Begin VB.Form frmManRecord1  
   BorderStyle     =   3  'Fixed Dialog 
   Caption         =   "员工信息" 
   ClientHeight    =   6564 
   ClientLeft      =   48 
   ClientTop       =   336 
   ClientWidth     =   8292 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MinButton       =   0   'False 
   ScaleHeight     =   6564 
   ScaleWidth      =   8292 
   ShowInTaskbar   =   0   'False 
   StartUpPosition =   1  'CenterOwner 
   Tag             =   "ru" 
   Begin VB.Frame Frame4  
      Caption         =   "其它信息" 
      Height          =   1455 
      Left            =   240 
      TabIndex        =   44 
      Top             =   4560 
      Width           =   7815 
      Begin VB.TextBox txtItem  
         Height          =   975 
         Index           =   18 
         Left            =   1200 
         MultiLine       =   -1  'True 
         ScrollBars      =   2  'Vertical 
         TabIndex        =   19 
         Top             =   360 
         Width           =   6375 
      End 
      Begin VB.Label Label2  
         Caption         =   "备    注:" 
         Height          =   255 
         Index           =   19 
         Left            =   240 
         TabIndex        =   45 
         Top             =   360 
         Width           =   975 
      End 
   End 
   Begin VB.Frame Frame3  
      Caption         =   "工作简历" 
      Height          =   855 
      Left            =   240 
      TabIndex        =   40 
      Top             =   3600 
      Width           =   7815 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   12 
         Left            =   5040 
         MaxLength       =   30 
         TabIndex        =   18 
         Top             =   360 
         Width           =   2535 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   13 
         Left            =   2760 
         MaxLength       =   10 
         TabIndex        =   17 
         Top             =   360 
         Width           =   1095 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   11 
         Left            =   960 
         MaxLength       =   12 
         TabIndex        =   16 
         Top             =   360 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "原工作单位:" 
         Height          =   255 
         Index           =   14 
         Left            =   3960 
         TabIndex        =   43 
         Top             =   360 
         Width           =   1215 
      End 
      Begin VB.Label Label2  
         Caption         =   "原职务:" 
         Height          =   255 
         Index           =   15 
         Left            =   2040 
         TabIndex        =   42 
         Top             =   360 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "原身份:" 
         Height          =   255 
         Index           =   9 
         Left            =   240 
         TabIndex        =   41 
         Top             =   360 
         Width           =   975 
      End 
   End 
   Begin VB.Frame Frame2  
      Caption         =   "工作信息" 
      Height          =   3255 
      Left            =   4080 
      TabIndex        =   31 
      Top             =   240 
      Width           =   3975 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   14 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   9 
         Top             =   720 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   15 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   10 
         Top             =   1080 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   16 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   11 
         Top             =   1440 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   17 
         Left            =   1560 
         MaxLength       =   8 
         TabIndex        =   15 
         Top             =   2880 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   7 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   8 
         Top             =   360 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   8 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   14 
         Top             =   2520 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   9 
         Left            =   1560 
         MaxLength       =   12 
         TabIndex        =   12 
         Top             =   1800 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   10 
         Left            =   1560 
         MaxLength       =   10 
         TabIndex        =   13 
         Top             =   2160 
         Width           =   2175 
      End 
      Begin VB.Label Label2  
         Caption         =   "进入公司时间:" 
         Height          =   255 
         Index           =   10 
         Left            =   240 
         TabIndex        =   39 
         Top             =   720 
         Width           =   1335 
      End 
      Begin VB.Label Label2  
         Caption         =   "起 薪 时 间 :" 
         Height          =   255 
         Index           =   11 
         Left            =   240 
         TabIndex        =   38 
         Top             =   1080 
         Width           =   1455 
      End 
      Begin VB.Label Label2  
         Caption         =   "调入部门时间 :" 
         Height          =   255 
         Index           =   17 
         Left            =   240 
         TabIndex        =   37 
         Top             =   1440 
         Width           =   1575 
      End 
      Begin VB.Label Label2  
         Caption         =   "档       号 :" 
         Height          =   255 
         Index           =   18 
         Left            =   240 
         TabIndex        =   36 
         Top             =   2880 
         Width           =   1335 
      End 
      Begin VB.Label Label2  
         Caption         =   "参加工作时间:" 
         Height          =   255 
         Index           =   5 
         Left            =   240 
         TabIndex        =   35 
         Top             =   360 
         Width           =   1335 
      End 
      Begin VB.Label Label2  
         Caption         =   "入 党 时 间 :" 
         Height          =   255 
         Index           =   6 
         Left            =   240 
         TabIndex        =   34 
         Top             =   2520 
         Width           =   1335 
      End 
      Begin VB.Label Label2  
         Caption         =   "职       称 :" 
         Height          =   255 
         Index           =   7 
         Left            =   240 
         TabIndex        =   33 
         Top             =   1800 
         Width           =   1455 
      End 
      Begin VB.Label Label2  
         Caption         =   "职 称 时 间 :" 
         Height          =   255 
         Index           =   8 
         Left            =   240 
         TabIndex        =   32 
         Top             =   2160 
         Width           =   1335 
      End 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "个人基本信息" 
      Height          =   3255 
      Left            =   240 
      TabIndex        =   22 
      Top             =   240 
      Width           =   3735 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   0 
         Left            =   1320 
         MaxLength       =   8 
         TabIndex        =   0 
         Top             =   360 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   1 
         Left            =   1320 
         MaxLength       =   10 
         TabIndex        =   1 
         Top             =   720 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   2 
         Left            =   1320 
         MaxLength       =   20 
         TabIndex        =   2 
         Top             =   1080 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   3 
         Left            =   1320 
         MaxLength       =   10 
         TabIndex        =   4 
         Top             =   1800 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   4 
         Left            =   1320 
         MaxLength       =   40 
         TabIndex        =   5 
         Top             =   2160 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   5 
         Left            =   1320 
         MaxLength       =   10 
         TabIndex        =   6 
         Top             =   2520 
         Width           =   2175 
      End 
      Begin VB.TextBox txtItem  
         Height          =   270 
         Index           =   6 
         Left            =   1320 
         MaxLength       =   20 
         TabIndex        =   7 
         Top             =   2880 
         Width           =   2175 
      End 
      Begin VB.ComboBox cboItem  
         Height          =   300 
         Left            =   1320 
         Style           =   2  'Dropdown List 
         TabIndex        =   3 
         Top             =   1440 
         Width           =   2175 
      End 
      Begin VB.Label Label2  
         Caption         =   "编    号:" 
         Height          =   255 
         Index           =   0 
         Left            =   240 
         TabIndex        =   30 
         Top             =   360 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "姓    名:" 
         Height          =   255 
         Index           =   1 
         Left            =   240 
         TabIndex        =   29 
         Top             =   720 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "性    别:" 
         Height          =   255 
         Index           =   2 
         Left            =   240 
         TabIndex        =   28 
         Top             =   1440 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "学    历:" 
         Height          =   255 
         Index           =   3 
         Left            =   240 
         TabIndex        =   27 
         Top             =   2520 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "专    业:" 
         Height          =   255 
         Index           =   4 
         Left            =   240 
         TabIndex        =   26 
         Top             =   2880 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "生    日:" 
         Height          =   255 
         Index           =   12 
         Left            =   240 
         TabIndex        =   25 
         Top             =   1800 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "籍    贯:" 
         Height          =   255 
         Index           =   13 
         Left            =   240 
         TabIndex        =   24 
         Top             =   2160 
         Width           =   975 
      End 
      Begin VB.Label Label2  
         Caption         =   "部    门:" 
         Height          =   255 
         Index           =   16 
         Left            =   240 
         TabIndex        =   23 
         Top             =   1080 
         Width           =   975 
      End 
   End 
   Begin VB.CommandButton cmdExit  
      Caption         =   "返回 (&X)" 
      Height          =   375 
      Left            =   6600 
      TabIndex        =   21 
      Top             =   6120 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdSave  
      Caption         =   "保存 (&S)" 
      Height          =   375 
      Left            =   5040 
      TabIndex        =   20 
      Top             =   6120 
      Width           =   1215 
   End 
End 
Attribute VB_Name = "frmManRecord1" 
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 
Dim mrc As ADODB.Recordset 
'操作的表名称 
Private Sub cboItem_Change() 
    '有变化设置gblchange 
    mblChange = True 
End Sub 
 
Private Sub cboItem_KeyDown(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 txtSQL As String 
    Dim MsgText As String 
    Dim sMeg As String 
    Dim i As Integer 
   
    For intCount = 0 To 2 
        If Trim(txtItem(intCount) & " ") = "" Then 
            Select Case intCount 
                Case 0 
                    sMeg = "编号" 
                Case 1 
                    sMeg = "姓名" 
                Case 3 
                    sMeg = "部门" 
            End Select 
            sMeg = sMeg & "不能为空!" 
            MsgBox sMeg, vbOKOnly + vbExclamation, "警告" 
            txtItem(intCount).SetFocus 
             
            Exit Sub 
        End If 
    Next intCount 
     
    If Trim(txtItem(3) & " ") <> "" Then 
        If Not IsDate(txtItem(3)) Then 
            MsgBox "生日应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(3).SetFocus 
             
            Exit Sub 
        Else 
            txtItem(3) = Format(txtItem(3), "yyyy-mm-dd") 
        End If 
    End If 
     
    If Trim(txtItem(7) & " ") <> "" Then 
        If Not IsDate(txtItem(7)) Then 
        MsgBox "参加工作时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(7).SetFocus 
         
            Exit Sub 
        Else 
            txtItem(7) = Format(txtItem(7), "yyyy-mm-dd") 
        End If 
    End If 
     
     If Trim(txtItem(8) & " ") <> "" Then 
        If Not IsDate(txtItem(8)) Then 
            MsgBox "入党时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(8).SetFocus 
 
            Exit Sub 
        Else 
            txtItem(8) = Format(txtItem(8), "yyyy-mm-dd") 
        End If 
    End If 
     
    If Trim(txtItem(10) & "") <> "" Then 
        If Not IsDate(txtItem(10)) Then 
            MsgBox "职称时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(10).SetFocus 
   
            Exit Sub 
        Else 
            txtItem(10) = Format(txtItem(10), "yyyy-mm-dd") 
        End If 
    End If 
     
    If Trim(txtItem(14) & "") <> "" Then 
        If Not IsDate(txtItem(14)) Then 
            MsgBox "进入公司时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(14).SetFocus 
        
            Exit Sub 
        Else 
            txtItem(14) = Format(txtItem(14), "yyyy-mm-dd") 
        End If 
    End If 
     
    If Trim(txtItem(15) & "") <> "" Then 
        If Not IsDate(txtItem(15)) Then 
            MsgBox "起薪时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(15).SetFocus 
       
            Exit Sub 
        Else 
            txtItem(15) = Format(txtItem(15), "yyyy-mm-dd") 
        End If 
    End If 
     
    If Trim(txtItem(16) & "") <> "" Then 
        If Not IsDate(txtItem(16)) Then 
            MsgBox "调入时间应输入日期(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告" 
            txtItem(16).SetFocus 
   
            Exit Sub 
        Else 
            txtItem(16) = Format(txtItem(16), "yyyy-mm-dd") 
        End If 
    End If 
     
    '添加判断是否有相同的ID记录 
    If gintMode = 1 Then 
        txtSQL = "select * from manrecord where ygid='" & Trim(txtItem(0)) & "'" 
        Set mrc = ExecuteSQL(txtSQL, MsgText) 
        If mrc.EOF = False Then 
            MsgBox "已经存在此员工档案编号的记录!", vbOKOnly + vbExclamation, "警告" 
            txtItem(0).SetFocus 
            txtItem(0).SelStart = 0 
            txtItem(0).SelLength = Len(txtItem(0)) 
            Exit Sub 
        End If 
        mrc.Close 
    End If 
         
   
        
    '先删除已有记录 
    txtSQL = "delete from manrecord where ygid='" & Trim(txtItem(0)) & "'" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
     
    '再加入新记录 
     
    txtSQL = "select * from manrecord" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
    mrc.AddNew 
     
    For intCount = 0 To 2 
        mrc.Fields(intCount) = Trim(txtItem(intCount)) 
    Next intCount 
     
    mrc.Fields(3) = Trim(cboItem.Text) 
         
    For intCount = 3 To 18 
        mrc.Fields(intCount + 1) = Trim(txtItem(intCount)) 
    Next intCount 
     
    mrc.Update 
     
    If gintMode = 1 Then 
        MsgBox "记录添加成功!", vbOKOnly + vbExclamation, "警告" 
        For i = 0 To 18 
            txtItem(i).Text = "" 
            mblChange = False 
        Next i 
        frmManRecord1.Show 
        frmManRecord1.ZOrder 0 
        frmManRecord.ShowTitle 
        frmManRecord.txtSQL = "select * from manrecord" 
        frmManRecord.ShowData 
        frmManRecord.ZOrder 1 
         
    Else 
        MsgBox "记录修改成功!", vbOKOnly + vbExclamation, "警告" 
        Unload Me 
        frmManRecord.ShowTitle 
        frmManRecord.txtSQL = "select * from manrecord" 
        frmManRecord.ShowData 
        frmManRecord.ZOrder 0 
    End If 
     
    gintMode = 0 
End Sub 
 
Private Sub Form_Load() 
    Dim MsgText As String 
    Dim intCount As Integer 
    With cboItem 
        .AddItem "男" 
        .AddItem "女" 
      
    End With 
     
    If gintMode = 1 Then 
        Me.Caption = Me.Caption & "添加" 
         
        cboItem.ListIndex = 0 
    ElseIf gintMode = 2 Then 
 
         
         
        Set mrc = ExecuteSQL(txtSQL, MsgText) 
         
        If mrc.EOF = False Then 
            With mrc 
                For intCount = 0 To 2 
                    txtItem(intCount) = .Fields(intCount) 
                Next intCount 
                If Not IsNull(!ygsex) Then 
                    cboItem = !ygsex 
                End If 
                For intCount = 3 To 18 
                    If Not IsNull(.Fields(intCount + 1)) Then 
                        txtItem(intCount) = .Fields(intCount + 1) 
                    End If 
                Next intCount 
            End With 
            txtItem(0).Enabled = False 
        End If 
        mrc.Close 
         
        Me.Caption = Me.Caption & "修改" 
             
        
    End If 
     
    mblChange = False 
     
 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
     
    'MsgBox "realy want to quit?", vbOKOnly + vbExclamation, "quit" 
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