www.pudn.com > new xsc.rar > frmup.frm


VERSION 5.00 
Begin VB.Form frmup  
   Caption         =   "修改班主任信息" 
   ClientHeight    =   5070 
   ClientLeft      =   60 
   ClientTop       =   345 
   ClientWidth     =   7125 
   LinkTopic       =   "Form1" 
   MaxButton       =   0   'False 
   MDIChild        =   -1  'True 
   ScaleHeight     =   5070 
   ScaleWidth      =   7125 
   Begin VB.Frame Frame2  
      Caption         =   "工作年数" 
      Height          =   1935 
      Left            =   3720 
      TabIndex        =   19 
      Top             =   1440 
      Width           =   2775 
      Begin VB.OptionButton Option2  
         Caption         =   "3年以上(含3年)" 
         Enabled         =   0   'False 
         Height          =   375 
         Index           =   2 
         Left            =   360 
         TabIndex        =   23 
         Top             =   1080 
         Width           =   2055 
      End 
      Begin VB.OptionButton Option2  
         Caption         =   "6年以上(含6年)" 
         Enabled         =   0   'False 
         Height          =   375 
         Index           =   1 
         Left            =   360 
         TabIndex        =   22 
         Top             =   720 
         Width           =   2055 
      End 
      Begin VB.OptionButton Option2  
         Caption         =   "3年以下" 
         Enabled         =   0   'False 
         Height          =   375 
         Index           =   3 
         Left            =   360 
         TabIndex        =   21 
         Top             =   1440 
         Value           =   -1  'True 
         Width           =   1815 
      End 
      Begin VB.OptionButton Option2  
         Caption         =   "8年以上(含8年)" 
         Enabled         =   0   'False 
         Height          =   375 
         Index           =   0 
         Left            =   360 
         TabIndex        =   20 
         Top             =   360 
         Width           =   2055 
      End 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   2 
      Left            =   1560 
      TabIndex        =   11 
      Top             =   1440 
      Width           =   1935 
   End 
   Begin VB.TextBox Text1  
      Height          =   375 
      Index           =   1 
      Left            =   1560 
      TabIndex        =   10 
      Top             =   840 
      Width           =   1455 
   End 
   Begin VB.ComboBox Combo1  
      Height          =   300 
      Left            =   1560 
      TabIndex        =   9 
      Text            =   "请选择" 
      Top             =   360 
      Width           =   1455 
   End 
   Begin VB.Frame Frame1  
      Caption         =   "在职或聘任" 
      Height          =   975 
      Left            =   3720 
      TabIndex        =   8 
      Top             =   360 
      Width           =   2775 
      Begin VB.ComboBox Combo4  
         Height          =   300 
         ItemData        =   "frmup.frx":0000 
         Left            =   240 
         List            =   "frmup.frx":000D 
         TabIndex        =   24 
         Text            =   "在职" 
         Top             =   360 
         Width           =   2295 
      End 
   End 
   Begin VB.Frame Frame3  
      Caption         =   "所在班级为毕业班" 
      Height          =   735 
      Left            =   3720 
      TabIndex        =   5 
      Top             =   3480 
      Width           =   2775 
      Begin VB.OptionButton Option3  
         Caption         =   "是" 
         Height          =   375 
         Index           =   0 
         Left            =   480 
         TabIndex        =   7 
         Top             =   240 
         Width           =   735 
      End 
      Begin VB.OptionButton Option3  
         Caption         =   "否" 
         Height          =   375 
         Index           =   1 
         Left            =   1560 
         TabIndex        =   6 
         Top             =   240 
         Value           =   -1  'True 
         Width           =   735 
      End 
   End 
   Begin VB.CommandButton Command1  
      Caption         =   "确定" 
      Height          =   495 
      Left            =   1440 
      TabIndex        =   4 
      Top             =   4320 
      Width           =   1695 
   End 
   Begin VB.CommandButton Command2  
      Caption         =   "取消" 
      Height          =   495 
      Left            =   3720 
      TabIndex        =   3 
      Top             =   4320 
      Width           =   1695 
   End 
   Begin VB.ComboBox Combo2  
      Height          =   300 
      ItemData        =   "frmup.frx":003D 
      Left            =   720 
      List            =   "frmup.frx":008F 
      TabIndex        =   2 
      Text            =   "选择年份" 
      Top             =   2640 
      Width           =   1815 
   End 
   Begin VB.ComboBox Combo3  
      Height          =   300 
      ItemData        =   "frmup.frx":012F 
      Left            =   720 
      List            =   "frmup.frx":0157 
      TabIndex        =   1 
      Text            =   "选择月份" 
      Top             =   3240 
      Width           =   1815 
   End 
   Begin VB.TextBox Text2  
      Enabled         =   0   'False 
      Height          =   495 
      Left            =   2400 
      TabIndex        =   0 
      Top             =   3720 
      Width           =   975 
   End 
   Begin VB.Label Label3  
      AutoSize        =   -1  'True 
      Caption         =   "电话" 
      Height          =   180 
      Left            =   600 
      TabIndex        =   18 
      Top             =   1530 
      Width           =   360 
   End 
   Begin VB.Label Label1  
      AutoSize        =   -1  'True 
      Caption         =   "姓名" 
      Height          =   180 
      Left            =   600 
      TabIndex        =   17 
      Top             =   930 
      Width           =   360 
   End 
   Begin VB.Label Label2  
      AutoSize        =   -1  'True 
      Caption         =   "班级" 
      Height          =   180 
      Left            =   600 
      TabIndex        =   16 
      Top             =   420 
      Width           =   360 
   End 
   Begin VB.Label Label4  
      AutoSize        =   -1  'True 
      Caption         =   "选择担任班主任起始时间" 
      Height          =   180 
      Left            =   600 
      TabIndex        =   15 
      Top             =   2160 
      Width           =   1980 
   End 
   Begin VB.Label Label5  
      AutoSize        =   -1  'True 
      Caption         =   "担任班主任至今年数" 
      Height          =   180 
      Left            =   600 
      TabIndex        =   14 
      Top             =   3840 
      Width           =   1620 
   End 
   Begin VB.Label Label6  
      AutoSize        =   -1  'True 
      Caption         =   "年" 
      Height          =   180 
      Left            =   2760 
      TabIndex        =   13 
      Top             =   2760 
      Width           =   180 
   End 
   Begin VB.Label Label7  
      AutoSize        =   -1  'True 
      Caption         =   "月" 
      Height          =   180 
      Left            =   2760 
      TabIndex        =   12 
      Top             =   3120 
      Width           =   180 
   End 
End 
Attribute VB_Name = "frmup" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
 
Private Sub Combo1_Click() 
   Dim mrccc As ADODB.Recordset 
  Dim msgtext As String 
  Dim txtSQL As String 
   Text1(1).Text = "" 
    Text1(2).Text = "" 
' Combo1.Clear 
  txtSQL = "select * from teacher  where class='" & Combo1 & "' " 
  Set mrccc = ExecuteSQL(txtSQL, msgtext) 
  If Not mrccc.EOF Then 
    Text1(1).Text = mrccc.Fields(1) 
    Text1(2).Text = mrccc.Fields(2) 
    Combo2 = Format(mrccc.Fields(6), "yyyy") 
    Combo3 = Format(mrccc.Fields(6), "mm") 
    Text2.Text = mrccc.Fields(7) 
    Combo4 = mrccc.Fields(3) 
    If mrccc.Fields(4) = 1 Then 
     Option2(3).Value = True 
    ElseIf mrccc.Fields(4) = 3 Then 
      Option2(2).Value = True 
    ElseIf mrccc.Fields(4) = 6 Then 
      Option2(1).Value = True 
    ElseIf mrccc.Fields(4) = 8 Then 
      Option2(0).Value = True 
    End If 
    If mrccc.Fields(5) = 0 Then 
     Option3(1).Value = True 
    Else 
      Option3(0).Value = True 
    End If 
   End If 
   mrccc.Close 
    
End Sub 
Private Sub Combo2_Click() 
  Combo3.Enabled = True 
  Combo2.Enabled = False 
End Sub 
 
Private Sub Combo3_Click() 
  Dim shijian As String 
  Dim yue As Integer 
  shijian = Format(CDate(Combo2 & "-" & Combo3), "yyyy-mm-dd") 
   yue = Int(DateDiff("m", DateValue(shijian), Format(Now, "yyyy-mm"))) 
   Text2.Text = Format(yue / 12, "0.0") 
   If Text2.Text < 3 Then 
     Option2(3).Value = True 
   ElseIf Text2.Text < 6 And Text2.Text >= 3 Then 
     Option2(2).Value = True 
   ElseIf Text2.Text < 8 And Text2.Text >= 6 Then 
     Option2(1).Value = True 
   ElseIf Text2.Text >= 8 Then 
     Option2(0).Value = True 
   End If 
   If shijian > Now Then 
     MsgBox "日期选择错误!不符合实际", vbOKOnly + vbExclamation, "警告" 
    Exit Sub 
   End If 
    
   Combo3.Enabled = False 
   Combo2.Enabled = True 
    
End Sub 
 
Private Sub Command1_Click() 
  Dim shijian1 As String 
   shijian1 = Format(CDate(Combo2 & "-" & Combo3 & "-" & "1"), "yyyy-mm-dd") 
   Dim b, c, f As Integer 
   Dim msgtext As String 
  If Combo1 = "请选择" Then 
     MsgBox "班级选择错误!", vbOKOnly + vbExclamation, "警告" 
      Exit Sub 
  End If 
  If Text1(1).Text = "" Then 
     MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告" 
      Exit Sub 
   End If 
   If Text1(2) = "" Then 
     MsgBox "请输入联系电话!", vbOKOnly + vbExclamation, "警告" 
      Exit Sub 
   End If 
   If Combo2 = "选择年份" Then 
     MsgBox "年份选择错误!", vbOKOnly + vbExclamation, "警告" 
     Exit Sub 
   End If 
  If Combo3 = "选择月份" Then 
     MsgBox "月份选择错误!", vbOKOnly + vbExclamation, "警告" 
      Exit Sub 
  End If 
  If Option2(0).Value Then 
    c = 8 
  ElseIf Option2(1).Value Then 
    c = 6 
  ElseIf Option2(2).Value Then 
    c = 3 
  ElseIf Option2(3).Value Then 
    c = 1 
  End If 
  If Option3(0).Value Then 
    f = 1 
  ElseIf Option3(1).Value Then 
    f = 0 
  End If 
  txtSQL = "delete from teacher where class='" & Trim(Combo1) & "'" 
  Set mr = ExecuteSQL(txtSQL, msgtext) 
  txtSQL = "execute teachersetup'" 
  txtSQL = txtSQL & Trim(Combo1) & "','" 
  txtSQL = txtSQL & Trim(Text1(1).Text) & "','" 
  txtSQL = txtSQL & Trim(Text1(2).Text) & "','" 
  txtSQL = txtSQL & Trim(Combo4) & "','" 
  txtSQL = txtSQL & c & "','" 
  txtSQL = txtSQL & f & "','" 
  txtSQL = txtSQL & shijian1 & "','" 
  txtSQL = txtSQL & Trim(Text2.Text) & "'" 
  
 
  Set mr = ExecuteSQL(txtSQL, msgtext) 
  Unload Me 
  MsgBox "修改成功!", vbOKOnly + vbExclamation, "提示" 
   
End Sub 
 
Private Sub Command2_Click() 
  Unload Me 
End Sub 
 
Private Sub Form_Load() 
Me.Height = 5475 
Me.Width = 7245 
Dim mrcc As ADODB.Recordset 
  Dim msgtext As String 
  Dim txtSQL As String 
'  Combo1.Clear 
 
  txtSQL = "select id from class" 
  Set mrcc = ExecuteSQL(txtSQL, msgtext) 
  Do While Not mrcc.EOF 
    Combo1.AddItem mrcc.Fields(0) 
    mrcc.MoveNext 
 Loop 
 mrcc.Close 
 Combo3.Enabled = False 
End Sub