📄 formjiao1.frm
字号:
VERSION 5.00
Begin VB.Form frmxuefei1
BackColor = &H00FF8080&
BorderStyle = 1 'Fixed Single
Caption = "学费设置"
ClientHeight = 3315
ClientLeft = 45
ClientTop = 330
ClientWidth = 6375
Icon = "Formjiao1.frx":0000
LinkTopic = "Form5"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 3315
ScaleWidth = 6375
Begin VB.Frame Frame2
BackColor = &H00FF8080&
Caption = "学费设置"
Height = 2535
Left = 120
TabIndex = 0
Top = 600
Width = 6135
Begin VB.ComboBox Combo1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 0
Left = 1080
TabIndex = 7
Text = "Combo1"
Top = 375
Width = 1215
End
Begin VB.ComboBox Combo1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 1
Left = 3360
TabIndex = 6
Text = "Combo1"
Top = 360
Width = 1215
End
Begin VB.ComboBox Combo1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 2
Left = 1080
TabIndex = 5
Text = "Combo1"
Top = 840
Width = 1215
End
Begin VB.ComboBox Combo1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 300
Index = 3
Left = 3360
TabIndex = 4
Text = "Combo1"
Top = 840
Width = 2535
End
Begin VB.TextBox Text1
BackColor = &H80000018&
ForeColor = &H000000FF&
Height = 270
Left = 1080
TabIndex = 3
Top = 1395
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 255
Left = 1080
TabIndex = 2
Top = 2160
Width = 1335
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 255
Left = 3120
TabIndex = 1
Top = 2160
Width = 1335
End
Begin VB.Label Label6
Caption = "年制:"
Height = 255
Left = 480
TabIndex = 13
Top = 885
Width = 615
End
Begin VB.Label Label5
Caption = "学期:"
Height = 255
Left = 2760
TabIndex = 12
Top = 885
Width = 615
End
Begin VB.Label Label3
Caption = "专业:"
Height = 255
Left = 2760
TabIndex = 11
Top = 375
Width = 615
End
Begin VB.Label Label2
Caption = "年级:"
Height = 255
Left = 480
TabIndex = 10
Top = 360
Width = 615
End
Begin VB.Label Label4
Caption = "学费:"
Height = 255
Left = 480
TabIndex = 9
Top = 1440
Width = 615
End
Begin VB.Label Label7
Caption = " 元"
Height = 255
Left = 2400
TabIndex = 8
Top = 1440
Width = 615
End
End
Begin VB.Label Label1
BackColor = &H00FF8080&
Caption = "学费设置"
BeginProperty Font
Name = "楷体_GB2312"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00800000&
Height = 375
Left = 2400
TabIndex = 14
Top = 120
Width = 1695
End
End
Attribute VB_Name = "frmxuefei1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim clas As String
Private Sub Combo1_Click(Index As Integer)
Dim mrc As ADODB.Recordset
If Index = 0 Then
txtsql = "select DISTINCT 专业 from class where 年级='" & Trim(Combo1(0).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
Combo1(1).Text = ""
Combo1(2).Text = ""
Exit Sub
End If
Combo1(1).Clear
mrc.MoveFirst
Do Until mrc.EOF
Combo1(1).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(1).ListIndex = 0
txtsql = "select DISTINCT 年制 from class where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
Combo1(2).Text = ""
Exit Sub
End If
Combo1(2).Clear
mrc.MoveFirst
Do Until mrc.EOF
Combo1(2).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(2).ListIndex = 0
ElseIf Index = 1 Then
txtsql = "select DISTINCT 年制 from class where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
Combo1(0).Text = ""
Combo1(2).Text = ""
Exit Sub
End If
Combo1(2).Clear
mrc.MoveFirst
Do Until mrc.EOF
Combo1(2).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(2).ListIndex = 0
End If
End Sub
Private Sub Combo1_DropDown(Index As Integer)
If Index = 0 Then
Dim mrc As ADODB.Recordset
txtsql = "select DISTINCT 年级 from class "
Set mrc = ExecuteSQL(txtsql)
mrc.MoveFirst
Combo1(0).Clear
Do While Not mrc.EOF
Combo1(0).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(0).ListIndex = 0
End If
End Sub
Private Sub Command1_Click()
If Combo1(0).Text = "" Then
ss = MsgBox("年级不能为空!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
If Combo1(1).Text = "" Then
ss = MsgBox("专业不能为空!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
If Combo1(2).Text = "" Then
ss = MsgBox("年制不能为空!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
If Combo1(3).Text = "" Then
ss = MsgBox("学期不能为空!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
If Text1.Text = "" Then
ss = MsgBox("学费不能为空!", vbExclamation + vbOKOnly, " 警告")
Exit Sub
End If
Dim mrc As ADODB.Recordset
txtsql = "select * from class where 专业='" & Trim(Combo1(1).Text) & "'and 年级='" & Trim(Combo1(0).Text) & "'and 年制='" & Trim(Combo1(2).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
xxxx = MsgBox("查无 " & Combo1(0).Text & Combo1(2).Text & Combo1(1).Text & "专业的班, " & "请先进行班级设置!", , "警告")
Exit Sub
End If
txtsql = "select * from xuefei where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'and 年制='" & Trim(Combo1(2).Text) & "' and 学期='" & Trim(Combo1(3).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = False Then
If xuefeimodi = True Then
If (Text1.Text) <> Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 5)) Then
sss = MsgBox("已存在该班级本学期学费设置和学费记录," & Chr(10) & Chr(13) & "继续会导致以上的数据丢失,继续吗?!", vbOKCancel + vbExclamation, "警告")
End If
Else
sss = MsgBox("已存在该班级本学期学费设置和学费记录," & Chr(10) & Chr(13) & "继续会导致以上的数据丢失,继续吗?!", vbOKCancel + vbExclamation, "警告")
End If
If sss = vbCancel Then
Exit Sub
Else
If xuefeimodi = True Then
txtsql = "delete * from xuefei where 年级='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 1)) & "' and 专业='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 2)) & "'and 年制='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 3)) & "' and 学期='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 4)) & "'"
Else
txtsql = "delete * from xuefei where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'and 年制='" & Trim(Combo1(2).Text) & "' and 学期='" & Trim(Combo1(3).Text) & "'"
End If
Set mrc = ExecuteSQL(txtsql)
txtsql = "delete * from jf where 学号 in(select DISTINCT xj.学号 from xj inner join class on xj.班级=class.班级 where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'and 年制='" & Trim(Combo1(2).Text) & "') and 学期='" & Trim(Combo1(3).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
End If
End If
txtsql = "select * from xuefei order by 学期,专业,年制"
Set mrc = ExecuteSQL(txtsql)
mrc.AddNew
mrc.Fields(0) = Trim(Combo1(0).Text)
mrc.Fields(1) = Trim(Combo1(1).Text)
mrc.Fields(2) = Trim(Combo1(2).Text)
mrc.Fields(3) = Trim(Combo1(3).Text)
mrc.Fields(4) = Trim(Text1.Text)
mrc.Update
If xuefeimodi = True Then
Unload Me
Else
For i = 0 To 3
Combo1(i).Text = ""
Next i
Text1.Text = ""
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Public Sub xuefeiload()
Dim mrc As ADODB.Recordset
If xuefeimodi Then '如果是修改状态
Dim i As Integer
For i = 0 To 3
Combo1(i).Enabled = False
Next i
Text1.SetFocus
Me.Caption = "修改学费设置"
txtsql = "select * from xuefei where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'and 年制='" & Trim(Combo1(2).Text) & "' and 学期='" & Trim(Combo1(3).Text) & "'"
txtsql = "select * from xuefei where 年级='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 1)) & "' and 专业='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 2)) & "'and 年制='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 3)) & "' and 学期='" & Trim(Frmxuefei2.MSF1.TextMatrix(Frmxuefei2.MSF1.Row, 4)) & "'"
Set mrc = ExecuteSQL(txtsql)
mrc.MoveFirst
For i = 0 To 3
Combo1(i).Text = mrc.Fields(i)
Next i
Text1.Text = mrc.Fields(4)
mrc.Close
Else
For i = 0 To 3
frmxuefei1.Combo1(i).Enabled = True
Next i
Me.Caption = "添加班级设置"
For i = 0 To 3
Combo1(i).Text = ""
Next i
Text1.Text = ""
End If
End Sub
Private Sub Form_Load()
Dim mrc As ADODB.Recordset
txtsql = "select DISTINCT 年级 from class "
Set mrc = ExecuteSQL(txtsql)
mrc.MoveFirst
Combo1(0).Clear
Do While Not mrc.EOF
Combo1(0).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(0).ListIndex = 0
txtsql = "select DISTINCT 专业 from class where 年级='" & Trim(Combo1(0).Text) & "'"
Set mrc = ExecuteSQL(txtsql)
Combo1(1).Clear
mrc.MoveFirst
Do While Not mrc.EOF
Combo1(1).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(1).ListIndex = 0
txtsql = "select DISTINCT 年制 from class where 年级='" & Trim(Combo1(0).Text) & "' and 专业='" & Trim(Combo1(1).Text) & "'"
Combo1(2).Clear
Set mrc = ExecuteSQL(txtsql)
mrc.MoveFirst
Do While Not mrc.EOF
Combo1(2).AddItem mrc.Fields(0)
mrc.MoveNext
Loop
Combo1(2).ListIndex = 0
mrc.Close
Combo1(3).AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第一学期"
Combo1(3).AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第二学期"
Combo1(3).AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第一学期"
Combo1(3).AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第二学期"
Combo1(3).AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第一学期"
Combo1(3).AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第二学期"
If Val(Format(Date, "mm")) > 8 Then
Combo1(3).ListIndex = 2
Else
Combo1(3).ListIndex = 1
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
For i = 0 To 3
Combo1(i).Enabled = True
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -