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

📄 frmempadd.frm

📁 一套比较完整的VB开发的员工请假管理系统
💻 FRM
📖 第 1 页 / 共 4 页
字号:

Emp_Sex = cmbEmpSex.ListIndex

If Trim(txtEmp_ID_cord.Text) <> Empty Then
    Emp_ID_cord = Trim(txtEmp_ID_cord.Text)
End If

If Trim(txtEmpMobil.Text) <> Empty Then
    Emp_mobile_num = Trim(txtEmpMobil.Text)
End If

If Trim(txtEmpTel.Text) <> Empty Then
    Emp_Tel_num = Trim(txtEmpTel.Text)
End If

If Trim(txtEmpAddr.Text) <> Empty Then
    Emp_Address = Trim(txtEmpAddr.Text)
End If

If Trim(txtEmpMemo.Text) <> Empty Then
   Emp_Memo = Trim(txtEmpMemo.Text)
End If


Emp_name_char = Trim(txtEmpChr.Text)

If Trim(cmbDepartID.Text) <> Empty Then
    vtempdata = Trim(cmbDepartID.Text)
   
    Depart_ID = frmEmployees.RecordSetFindItem(rctDepartList, "Depart_Name", vtempdata, 0)

    
End If

If Trim(cmbEmpMs.Text) <> Empty Then
    vtempdata = Trim(cmbEmpMs.Text)
    MS_ID = frmEmployees.RecordSetFindItem(rctMarriageStatus, "MS_Name", vtempdata, 0)
End If

If Trim(cmbEmpPs.Text) <> Empty Then
    vtempdata = Trim(cmbEmpPs.Text)
    P_ID = Trim(frmEmployees.RecordSetFindItem(rctPlitics, "P_Name", vtempdata, 0))
End If

If Trim(cmbEmpEdu.Text) <> Empty Then
    vtempdata = Trim(cmbEmpEdu.Text)
    E_ID = Trim(frmEmployees.RecordSetFindItem(rctEdulevel, "E_Name", vtempdata, 0))
End If

If Trim(cmbEmpJob.Text) <> Empty Then
    vtempdata = Trim(cmbEmpJob.Text)
    Job_ID = Trim(frmEmployees.RecordSetFindItem(rctJobList, "Job_Name", vtempdata, 0))
End If

If Trim(cmbEmpTitel.Text) <> Empty Then
    vtempdata = Trim(cmbEmpTitel.Text)
    Titel_ID = Trim(frmEmployees.RecordSetFindItem(rctTitelList, "Titel_Name", vtempdata, 0))
End If


'下面是写入数据库
'MsgBox "no error"

If frmEmpAdd.Caption = "新增记录" Then

    rctEmployees.AddNew
 
End If

If SaveEmployeesRecords(rctEmployees, Emp_ID, Emp_Name, Emp_Sex, Depart_ID, Job_ID, Titel_ID, E_ID, P_ID, MS_ID, Emp_ID_cord, Emp_birthday, Emp_Attend_time, Emp_Join_time, Emp_mobile_num, Emp_Tel_num, Emp_Address, Emp_Memo, Emp_name_char) = True Then
    If frmEmpAdd.Caption = "新增记录" Then
        Call frmEmpAddClear
    End If
'        frmEmployees.flexEmployees.Redraw = False
'       Call frmEmployees.IniGrid(frmEmployees.flexEmployees)
'       Call frmEmployees.showdata(rctEmployees, frmEmployees.flexEmployees)
'       frmEmployees.flexEmployees.Redraw = True
        MsgBox "保存记录成功", vbInformation, "保存记录"
End If
    
End Sub

Private Sub Form_Load()

Call IniCmbwithRecordset(cmbDepartID, "select Depart_Name from DepartList")

cmbEmpSex.AddItem "女"
cmbEmpSex.AddItem "男"
cmbEmpSex.ListIndex = 1

Call IniCmbwithRecordset(cmbEmpMs, "select MS_Name from MarriageStatus")
Call IniCmbwithRecordset(cmbEmpPs, "select P_Name from Plitics")
Call IniCmbwithRecordset(cmbEmpEdu, "select E_Name from Edulevel")
Call IniCmbwithRecordset(cmbEmpJob, "select Job_Name from JobList")
Call IniCmbwithRecordset(cmbEmpTitel, "select Titel_Name from TitelList")

'Call IniFromAdd(rctEmployees)

End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If MsgBox("在退出之前确定记录是否已经保存了!您真的要退出吗?", vbQuestion + vbYesNo, "退出") = vbNo Then
    Cancel = True
    Exit Sub
End If
End Sub

Private Sub Form_Unload(Cancel As Integer)

   frmEmployees.flexEmployees.Redraw = False
    Call frmEmployees.IniGrid(frmEmployees.flexEmployees)
    Call frmEmployees.ShowData(rctEmployees, frmEmployees.flexEmployees)
    frmEmployees.flexEmployees.Redraw = True



End Sub

Private Sub mskEmpAttendTime_GotFocus()
    mskEmpAttendTime.SelStart = 0
End Sub

Private Sub mskEmpAttendTime_KeyPress(KeyAscii As Integer)
    Dim intIsSpace As Integer
    Dim intSelstart As Integer
        

   With mskEmpAttendTime
        intSelstart = .SelStart
        intIsSpace = InStr(.Text, " ")
      ' MsgBox intIsSpace & "," & intSelstart
        If intIsSpace > 0 And intSelstart <> intIsPace Then
            .SelStart = intIsSpace - 1
        End If
    If intIsSpace = 1 Then
        If KeyAscii = Asc("0") Then
            KeyAscii = 0
        End If
    Else
    
         If .SelStart = 5 Then
            If KeyAscii > Asc("1") Then
                KeyAscii = 0
            End If
            

         End If
         
         If .SelStart = 6 Then
            If Mid(.Text, 6, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
         If .SelStart = 8 Then
            If Mid(.Text, 6, 2) = "02" Then
                If KeyAscii > Asc("2") Then
                    KeyAscii = 0
                End If
            End If
            If KeyAscii > Asc("3") Then
                KeyAscii = 0
            End If
            

            
         End If
         
         If .SelStart = 9 Then
        
            If Mid(.Text, 9, 1) = "3" Then
            'MsgBox Mid(.Text, 9, 1)
                If KeyAscii > Asc("1") Then
                    KeyAscii = 0
                End If
            End If
            
            If Mid(.Text, 9, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
    End If
End With

End Sub

Private Sub mskEmpBirth_GotFocus()
mskEmpBirth.SelStart = 0
End Sub

Private Sub mskEmpBirth_KeyPress(KeyAscii As Integer)
    Dim intIsSpace As Integer
    Dim intSelstart As Integer
        

   With mskEmpBirth
        intSelstart = .SelStart
        intIsSpace = InStr(.Text, " ")
      ' MsgBox intIsSpace & "," & intSelstart
        If intIsSpace > 0 And intSelstart <> intIsPace Then
            .SelStart = intIsSpace - 1
        End If
    If intIsSpace = 1 Then
        If KeyAscii = Asc("0") Then
            KeyAscii = 0
        End If
    Else
    
         If .SelStart = 5 Then
            If KeyAscii > Asc("1") Then
                KeyAscii = 0
            End If
            

         End If
         
         If .SelStart = 6 Then
            If Mid(.Text, 6, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
         If .SelStart = 8 Then
            If Mid(.Text, 6, 2) = "02" Then
                If KeyAscii > Asc("2") Then
                    KeyAscii = 0
                End If
            End If
            If KeyAscii > Asc("3") Then
                KeyAscii = 0
            End If
            

            
         End If
         
         If .SelStart = 9 Then
        
            If Mid(.Text, 9, 1) = "3" Then
            'MsgBox Mid(.Text, 9, 1)
                If KeyAscii > Asc("1") Then
                    KeyAscii = 0
                End If
            End If
            
            If Mid(.Text, 9, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
    End If
End With
End Sub

Private Sub mskJOinTime_GotFocus()
    mskJOinTime.SelStart = 0
End Sub

Private Sub mskJOinTime_KeyPress(KeyAscii As Integer)
    Dim intIsSpace As Integer
    Dim intSelstart As Integer
        

   With mskJOinTime
        intSelstart = .SelStart
        intIsSpace = InStr(.Text, " ")
      ' MsgBox intIsSpace & "," & intSelstart
        If intIsSpace > 0 And intSelstart <> intIsPace Then
            .SelStart = intIsSpace - 1
        End If
    If intIsSpace = 1 Then
        If KeyAscii = Asc("0") Then
            KeyAscii = 0
        End If
    Else
    
         If .SelStart = 5 Then
            If KeyAscii > Asc("1") Then
                KeyAscii = 0
            End If
            

         End If
         
         If .SelStart = 6 Then
            If Mid(.Text, 6, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
         If .SelStart = 8 Then
            If Mid(.Text, 6, 2) = "02" Then
                If KeyAscii > Asc("2") Then
                    KeyAscii = 0
                End If
            End If
            If KeyAscii > Asc("3") Then
                KeyAscii = 0
            End If
            

            
         End If
         
         If .SelStart = 9 Then
        
            If Mid(.Text, 9, 1) = "3" Then
            'MsgBox Mid(.Text, 9, 1)
                If KeyAscii > Asc("1") Then
                    KeyAscii = 0
                End If
            End If
            
            If Mid(.Text, 9, 1) = "0" Then
                If KeyAscii = Asc("0") Then
                    KeyAscii = 0
                End If
            End If
         End If
         
    End If
End With
End Sub

Private Sub txtEmp_ID_cord_KeyPress(KeyAscii As Integer)
    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 9) Then
        KeyAscii = 0
    
    End If
End Sub

Private Sub txtEmpChr_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("a") And (KeyAscii <= Asc("z"))) And Not (KeyAscii >= Asc("A") And (KeyAscii <= Asc("Z"))) And Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 9) Then
    KeyAscii = 0    '输入的不是字母则不接受
Else
    If (KeyAscii >= Asc("a") And (KeyAscii <= Asc("z"))) Then
       KeyAscii = KeyAscii - 32         '小写转为大写
    End If
End If



End Sub

Private Sub txtEmpModibl_KeyPress(KeyAscii As Integer)
    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 9) Then
        KeyAscii = 0
    
    End If
End Sub

Private Sub txtEmpMobil_KeyPress(KeyAscii As Integer)
    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 9) Then
        KeyAscii = 0
    
    End If
End Sub

Private Sub txtEmpTel_KeyPress(KeyAscii As Integer)
    If (KeyAscii < Asc("0") Or KeyAscii > Asc("9")) And Not (KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 9) Then
        KeyAscii = 0
    
    End If
End Sub

⌨️ 快捷键说明

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