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

📄 frmjf2.frm

📁 学生学籍管理系统 VB
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   2040
         TabIndex        =   12
         Top             =   360
         Width           =   1815
      End
   End
End
Attribute VB_Name = "Frmjf1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public bbb As Boolean
Private Sub Combo1_Click()
If Combo2.Text = "" Or Combo1.Text = "" Then
Exit Sub
End If
txtsql = "select 学费 from xuefei where 学期='" & Trim(Combo1.Text) & "' and 专业=(select 专业 from class where 班级='" & Trim(Combo2.Text) & "') and 年制=(select 年制 from class where 班级='" & Trim(Combo2.Text) & "') and 年级=(select 年级 from class where 班级='" & Trim(Combo2.Text) & "')"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
  sss = MsgBox("请先设置该班级的学费!", vbExclamation + vbOKOnly, "警告")
  Command1.Enabled = False
  Text1(0).Text = ""
  Exit Sub
Else
  Command1.Enabled = True
End If
  Text1(0).Text = mrc.Fields(0)
End Sub

Private Sub Combo2_Click()
Dim mrc As ADODB.Recordset
txtsql = "select  DISTINCT 学号  from xj where 班级='" & Trim(Combo2.Text) & "' order by 学号"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
Combo4.Clear
Text2.Text = ""
Else
mrc.MoveFirst
Combo4.Clear
Do While Not mrc.EOF
  Combo4.AddItem mrc.Fields(0)
 
 mrc.MoveNext
 Loop
 Combo4.ListIndex = 0
Set mrc = Nothing
End If
If Combo2.Text = "" Or Combo1.Text = "" Then
Exit Sub
End If
txtsql = "select 学费 from xuefei where 学期='" & Trim(Combo1.Text) & "' and 专业=(select 专业 from class where 班级='" & Trim(Combo2.Text) & "') and 年制=(select 年制 from class where 班级='" & Trim(Combo2.Text) & "') and 年级=(select 年级 from class where 班级='" & Trim(Combo2.Text) & "')"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
  sss = MsgBox("请先设置该班级的学费!", vbExclamation + vbOKOnly, "警告")
  Command1.Enabled = False
  Text1(0).Text = ""
  Text1(1).Text = ""
  Text1(2).Text = ""
  Text1(3).Text = ""
  Text1(4).Text = ""
  Exit Sub
  Else
  Command1.Enabled = True
End If
  Text1(0).Text = mrc.Fields(0)
Set mrc = Nothing
End Sub

Private Sub Combo4_Change()
If Trim(Combo4.Text) = "" Then
 List1.Clear
 List1.Visible = False
 Exit Sub
End If
If bbb = True Then
List1.Clear
 List1.Visible = False
     Dim mrc As ADODB.Recordset
txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
 If mrc.EOF = True Then
  sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
  Text2.Text = ""
  Exit Sub
End If
Text2.Text = mrc.Fields(0)
 Set mrc = Nothing

 Exit Sub
End If
 Dim rst As ADODB.Recordset
  Dim str As String
  str = "select 学号 from xj where 学号 like'" & Trim(Combo4.Text) & "%' and 班级='" & Trim(Combo2.Text) & "' order by 学号"
 Set rst = ExecuteSQL(str)
  If rst.EOF = True Then
   List1.Clear
   List1.Visible = False
   Set rst = Nothing
   Exit Sub
  End If
  List1.Clear
  Do Until rst.EOF
   List1.AddItem rst.Fields(0)
   rst.MoveNext
  Loop
   Set rst = Nothing
  List1.Visible = True
End Sub

Private Sub Combo4_Click()
Dim mrc As ADODB.Recordset
txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
Text2.Text = mrc.Fields(0)
 Text1(1).SetFocus
  txtsql = "select  学号,sum(欠费) from jf group by 学号 having 学号='" & Trim(Combo4.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
  Text1(3).Text = "0"
  Text1(4).Text = "0"
 Exit Sub
End If
 Text1(1).SetFocus
  Text1(3).Text = mrc.Fields(1)
   Text1(4).Text = mrc.Fields(1)
 Set mrc = Nothing
End Sub

Private Sub Combo4_KeyPress(KeyAscii As Integer)
'List1.Visible = True
If KeyAscii = 13 Then
Dim mrc As ADODB.Recordset
txtsql = "select   DISTINCT 姓名 from xj where 学号 ='" & Trim(Combo4.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
 If mrc.EOF = True Then
  sss = MsgBox("没有此学号!", vbExclamation + vbOKOnly, "警告")
  Text2.Text = ""
  Text1(1).Text = ""
  Text1(2).Text = ""
  Text1(3).Text = ""
  Text1(4).Text = ""
  Exit Sub
End If
Text2.Text = mrc.Fields(0)
Text1(1).SetFocus
 Set mrc = Nothing
 Else
 bbb = False
 End If
End Sub


Private Sub Command1_Click()
If Trim(Combo4.Text) = "" Then
  ss = MsgBox("学号不能为空!", vbExclamation + vbOKOnly, "警告")
     Combo4.SetFocus
    Exit Sub
End If
If Trim(Text1(1).Text) = "" Then
  ss = MsgBox("交费不能为空!", vbExclamation + vbOKOnly, "警告")
     Text1(1).SetFocus
    Exit Sub
End If

Dim mrc As ADODB.Recordset
txtsql = "select * from xj where 学号='" & Trim(Combo4.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = True Then
   sss = MsgBox("该班级不存在该学生记录!", vbExclamation + vbOKOnly, "警告")
   Combo4.SetFocus
   Combo4.SelStart = 0
   Combo4.SelLength = Len(Combo4.Text)
Exit Sub
End If
txtsql = "select * from jf where 学号='" & Trim(Combo4.Text) & "' and 学期='" & Trim(Combo1.Text) & "'"
Set mrc = ExecuteSQL(txtsql)
If mrc.EOF = False Then
   sss = MsgBox("已经存在该学生本学期的交费记录!", vbExclamation + vbOKOnly, "警告")
Exit Sub
End If
txtsql = "select * from jf"
Set mrc = ExecuteSQL(txtsql)
mrc.AddNew
mrc.Fields(0) = Trim(Combo4.Text)
mrc.Fields(1) = Trim(Combo1.Text)
mrc.Fields(2) = Trim(Text1(1).Text)
mrc.Fields(3) = Trim(Text1(2).Text)
mrc.Fields(4) = Date
mrc.Fields(5) = username
mrc.Update
Combo4.Text = ""
For i = 1 To 3
Text1(i).Text = ""
Next i
End Sub

Private Sub Command1_GotFocus()
Text1(2).Text = Val(Text1(0).Text) - Val(Text1(1).Text)
 Text1(4).Text = Val(Text1(3).Text) + Val(Text1(2).Text)
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Activate()
List1.Visible = False
Dim mrc As ADODB.Recordset
 txtsql = "select  DISTINCT 班级  from class order by 班级"
 Set mrc = ExecuteSQL(txtsql)
mrc.MoveFirst
Combo2.Clear
Do While Not mrc.EOF
  Combo2.AddItem mrc.Fields(0)
 
 mrc.MoveNext
 Loop
 Combo2.ListIndex = 0
 

 Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第一学期"
 Combo1.AddItem Val(Format(Date, "yyyy")) - 1 & "---" & Val(Format(Date, "yyyy")) & "年度第二学期"
 Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第一学期"
 Combo1.AddItem Format(Date, "yyyy") & "---" & Val(Format(Date, "yyyy")) + 1 & "年度第二学期"
 Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第一学期"
  Combo1.AddItem Val(Format(Date, "yyyy")) + 1 & "---" & Val(Format(Date, "yyyy")) + 2 & "年度第二学期"
 If Val(Format(Date, "mm")) > 8 Then
  Combo1.ListIndex = 2
 Else
   Combo1.ListIndex = 1
End If

 Set mrc = Nothing

End Sub

Private Sub List1_Click()
bbb = True
 Combo4.Text = List1.List(List1.ListIndex)
End Sub

Private Sub Text1_GotFocus(Index As Integer)
List1.Visible = False
If Index = 1 Then
   Text1(1).Text = Text1(0).Text
    Text1(1).SelStart = 0
   Text1(1).SelLength = Len(Text1(1).Text)
 Else
   Command1.SetFocus
 End If
End Sub

Private Sub Text1_KeyPress(Index As Integer, KeyAscii As Integer)
Dim shao As Integer
Dim zs As String
If KeyAscii <> 8 And KeyAscii <> 13 Then
shao = InStr(Trim(Text1(Index).Text), ".")
If shao <> 0 Then
zs = Right(Trim(Text1(Index).Text), Len(Trim(Text1(Index).Text)) - shao)
If Len(zs) > 1 Then KeyAscii = 0
End If
End If
If KeyAscii = 13 Or KeyAscii = 46 Or KeyAscii > 47 And KeyAscii < 58 Or KeyAscii = 8 Then
Else
  KeyAscii = 0
  Exit Sub
End If
If KeyAscii = 13 Then
 Text1(2).Text = Val(Text1(0).Text) - Val(Text1(1).Text)
 Text1(4).Text = Val(Text1(3).Text) + Val(Text1(2).Text)
  Command1.SetFocus
End If
End Sub

Private Sub Text1_LostFocus(Index As Integer)
 If Command1.Enabled = True Then
  Command1.SetFocus
 End If
End Sub

⌨️ 快捷键说明

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