📄 frmaddteacher.frm
字号:
VERSION 5.00
Begin VB.Form frmaddteacher
Caption = "添加班主任信息"
ClientHeight = 5040
ClientLeft = 60
ClientTop = 345
ClientWidth = 7260
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 5040
ScaleWidth = 7260
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Text2
Enabled = 0 'False
Height = 495
Left = 2400
TabIndex = 19
Top = 3720
Width = 975
End
Begin VB.ComboBox Combo3
Height = 300
ItemData = "frmaddteacher.frx":0000
Left = 720
List = "frmaddteacher.frx":0028
TabIndex = 17
Text = "选择月份"
Top = 3120
Width = 1815
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "frmaddteacher.frx":0053
Left = 720
List = "frmaddteacher.frx":00A5
TabIndex = 16
Text = "选择年份"
Top = 2640
Width = 1815
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 495
Left = 3720
TabIndex = 14
Top = 4320
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 495
Left = 1320
TabIndex = 13
Top = 4320
Width = 1695
End
Begin VB.Frame Frame3
Caption = "所在班级为毕业班"
Height = 735
Left = 3720
TabIndex = 9
Top = 3480
Width = 2775
Begin VB.OptionButton Option3
Caption = "否"
Height = 375
Index = 1
Left = 1560
TabIndex = 11
Top = 240
Value = -1 'True
Width = 735
End
Begin VB.OptionButton Option3
Caption = "是"
Height = 375
Index = 0
Left = 480
TabIndex = 10
Top = 240
Width = 735
End
End
Begin VB.Frame Frame2
Caption = "工作年数"
Height = 1935
Left = 3720
TabIndex = 7
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 = 12
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 = 8
Top = 360
Width = 2055
End
End
Begin VB.Frame Frame1
Caption = "班主任情况"
Height = 975
Left = 3720
TabIndex = 6
Top = 360
Width = 2775
Begin VB.ComboBox Combo4
Height = 300
ItemData = "frmaddteacher.frx":0145
Left = 360
List = "frmaddteacher.frx":0152
TabIndex = 24
Text = "在职"
Top = 360
Width = 2175
End
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1560
TabIndex = 5
Text = "请选择"
Top = 360
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Index = 1
Left = 1560
TabIndex = 2
Top = 840
Width = 1455
End
Begin VB.TextBox Text1
Height = 375
Index = 2
Left = 1560
TabIndex = 0
Top = 1440
Width = 1935
End
Begin VB.Label Label7
AutoSize = -1 'True
Caption = "月"
Height = 180
Left = 2760
TabIndex = 21
Top = 3120
Width = 180
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "年"
Height = 180
Left = 2760
TabIndex = 20
Top = 2760
Width = 180
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "担任班主任至今年数"
Height = 180
Left = 600
TabIndex = 18
Top = 3840
Width = 1620
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "选择担任班主任起始时间"
Height = 180
Left = 600
TabIndex = 15
Top = 2160
Width = 1980
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "班级"
Height = 180
Left = 600
TabIndex = 4
Top = 420
Width = 360
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "姓名"
Height = 180
Left = 600
TabIndex = 3
Top = 937
Width = 360
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "电话"
Height = 180
Left = 600
TabIndex = 1
Top = 1537
Width = 360
End
End
Attribute VB_Name = "frmaddteacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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
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
shijian1 = Format(CDate(Combo2 & "-" & Combo3 & "-" & "1"), "yyyy-mm-dd")
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 = "select * from teacher where class='" & Trim(Combo1) & "'"
Set mr = ExecuteSQL(txtSQL, msgtext)
If mr.EOF = False Then
MsgBox "该班级已经配备班主任,如需要改动请执行修改操作!", vbOKOnly + vbExclamation, "警告"
Combo1 = "请选择"
Text1(1).Text = ""
Text1(2).Text = ""
Exit Sub
End If
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)
MsgBox "添加成功!", vbOKOnly + vbExclamation, "提示"
Unload Me
Me.Show
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
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
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -