📄 form17.frm
字号:
sndPlaySound App.Path + "\声音\2.wav", &H0
Case vbKey3
sndPlaySound App.Path + "\声音\3.wav", &H0
Case vbKey4
sndPlaySound App.Path + "\声音\4.wav", &H0
Case vbKey5
sndPlaySound App.Path + "\声音\5.wav", &H0
Case vbKey6
sndPlaySound App.Path + "\声音\6.wav", &H0
Case vbKey7
sndPlaySound App.Path + "\声音\7.wav", &H0
Case vbKey8
sndPlaySound App.Path + "\声音\8.wav", &H0
Case vbKey9
sndPlaySound App.Path + "\声音\9.wav", &H0
Case vbKeyNumpad0
sndPlaySound App.Path & "\声音\0.wav", &H0
Case vbKeyNumpad1
sndPlaySound App.Path + "\声音\1.wav", &H0
Case vbKeyNumpad2
sndPlaySound App.Path + "\声音\2.wav", &H0
Case vbKeyNumpad3
sndPlaySound App.Path + "\声音\3.wav", &H0
Case vbKeyNumpad4
sndPlaySound App.Path + "\声音\4.wav", &H0
Case vbKeyNumpad5
sndPlaySound App.Path + "\声音\5.wav", &H0
Case vbKeyNumpad6
sndPlaySound App.Path + "\声音\6.wav", &H0
Case vbKeyNumpad7
sndPlaySound App.Path + "\声音\7.wav", &H0
Case vbKeyNumpad8
sndPlaySound App.Path + "\声音\8.wav", &H0
Case vbKeyNumpad9
sndPlaySound App.Path + "\声音\9.wav", &H0
End Select
End Sub
Private Sub ROButton4_Click()
Form16.Show
End Sub
Private Sub DBCombo1_LostFocus()
Data1.ReadOnly = False
'Data1.Refresh
End Sub
Private Sub ROButton3_Click()
Data2.ReadOnly = False
'Text6.Visible = True
Data1.Visible = False
Data2.Visible = True
'DBCombo1.Text = ""
DBCombo1.Enabled = False
Label1.Visible = False
Text1.Visible = False
Label2.Visible = False
Text2.Visible = False
Label3.Visible = False
Text3.Visible = False
Label4.Visible = False
Text4.Visible = False
'ROButton2.Visible = False
Form8.Show
DBGrid1.Visible = True
End Sub
Private Sub DBCombo1_Click(Area As Integer)
Data1.ReadOnly = True
If Area = 0 Then
Text5.Text = ""
Else
Text5.Text = DBCombo1.Text
End If
If Text5.Text = "" Then
Data1.RecordSource = "学生情况表"
Else
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'"
Data1.Refresh
End If
End Sub
Private Sub DBCombo1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyF1 Then
DBCombo1.Locked = True
DBCombo1.BackColor = &HC0C0C0
End If
If KeyCode = vbKeyF2 Then
DBCombo1.Locked = False
DBCombo1.BackColor = &HFFFFFF
End If
End Sub
Private Sub DBGrid2_GotFocus()
Timer1.Interval = 10
End Sub
Private Sub DBGrid2_LostFocus()
Timer1.Interval = 0
End Sub
Private Sub DBGrid1_HeadClick(ByVal ColIndex As Integer)
Select Case ColIndex
Case 0
If stre = True Then
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label1.caption
Data1.Refresh
stre = False
Else
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label1.caption & " desc"
Data1.Refresh
stre = True
End If
Case 1
If stre = True Then
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label2.caption
Data1.Refresh
stre = False
Else
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label2.caption & " desc"
Data1.Refresh
stre = True
End If
Case 2
If stre = True Then
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label3.caption
Data1.Refresh
stre = False
Else
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label3.caption & " desc"
Data1.Refresh
stre = True
End If
Case 3
If stre = True Then
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label4.caption
Data1.Refresh
stre = False
Else
Data1.RecordSource = "SELECT " & Label1.caption & "," & Label2.caption & "," & Label3.caption & "," & Label4.caption & ",毕业学校 FROM 学生情况表 WHERE " & "毕业学校" & " = " & " '" & Text5.Text & "'ORDER BY " & Label4.caption & " desc"
Data1.Refresh
stre = True
End If
End Select
End Sub
Private Sub Form_Load()
Dim a As Integer
On Error Resume Next
Data1.DatabaseName = App.Path + "\" + "teacher.mdb"
Data1.RecordSource = "学生情况表"
Data2.DatabaseName = App.Path + "\" + "teacher.mdb"
Data2.RecordSource = "毕业学校"
Data1.ReadOnly = True
'DBCombo1.Locked = True
'Data2.ReadOnly = True
DBGrid1.DefColWidth = 750
'DBGrid2.Visible = True
DBGrid1.Refresh
DBGrid1.Visible = True
'Data2.Visible = True
Data1.Visible = True
''Data2.Recordset.MoveFirst
'Data2.Recordset.MoveLast
stre = True
Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub
Private Sub ROButton1_Click()
On Error Resume Next
Timer1.Interval = 10
ROButton2.Visible = True
Label1.Visible = True
Text1.Visible = True
Label2.Visible = True
Text2.Visible = True
Label3.Visible = True
Text3.Visible = True
Label4.Visible = True
Text4.Visible = True
Label7.Visible = False
Text6.Visible = False
DBCombo1.Enabled = True
'DBCombo1.Locked = True
DBGrid1.Visible = True
'DBGrid2.Visible = False
'Data1.ReadOnly = False
Data1.Refresh
Data1.Recordset.MoveLast
Data1.Recordset.AddNew
Timer1.Interval = 0
Text1.SetFocus
End Sub
Private Sub dbgrid1_dblclick()
On Error Resume Next '选择当前项后,再双击删除当前记录选项
Data1.Recordset.Delete
DBCombo1.Refresh
DBGrid1.Refresh
End Sub
'Private Sub dbgrid2_dblclick() '选择当前项后,再双击删除当前记录选项
'On Error Resume Next
''DBGrid2.Visible = True
'Data2.Recordset.Delete
'DBCombo1.Refresh
'DBGrid1.Refresh
'End Sub
Private Sub Text1_GotFocus()
Dim i, j As Integer
i = Data1.Recordset.RecordCount
j = Data2.Recordset.RecordCount
Data1.caption = "共计" + Str(i) + "位同学"
Data2.caption = "共计" + Str(j) + "所学校"
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
FaSheng KeyCode
If KeyCode = vbKeyF1 Then
Text1.Locked = True
Text1.BackColor = &HC0C0C0
End If
If KeyCode = vbKeyF2 Then
Text1.Locked = False
Text1.BackColor = &HFFFFFF
End If
If KeyCode = vbKeyReturn Then
'FaSheng (Text1.Text)
If Text2.Locked = False Then
Text2.SetFocus
Else
If Text3.Locked = False Then
Text3.SetFocus
Else
If Text4.Locked = False Then
Text4.SetFocus
Else
ROButton1.SetFocus
End If
End If
End If
End If
If KeyCode = vbKeyDown Then
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyUp Then
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
FaSheng KeyCode
If KeyCode = vbKeyF1 Then
Text3.Locked = True
Text3.BackColor = &HC0C0C0
End If
If KeyCode = vbKeyF2 Then
Text3.Locked = False
Text3.BackColor = &HFFFFFF
End If
If KeyCode = vbKeyReturn Then
'FaSheng (Text3.Text)
If Text4.Locked = False Then
Text4.SetFocus
Else
ROButton1.SetFocus
End If
End If
If KeyCode = vbKeyDown Then
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyUp Then
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
On Error Resume Next
FaSheng KeyCode
If KeyCode = vbKeyF1 Then
Text4.Locked = True
Text4.BackColor = &HC0C0C0
End If
If KeyCode = vbKeyF2 Then
Text4.Locked = False
Text4.BackColor = &HFFFFFF
End If
If KeyCode = vbKeyReturn Then
'FaSheng (Text4.Text)
ROButton1.SetFocus
' Data1.Recordset.AddNew
Data1.Recordset.Update
' Data1.ReadOnly = False
'Data1.Refresh
'Data1.Recordset.Edit
Data1.Recordset.MoveNext
'DBGrid1.Refresh
End If
If KeyCode = vbKeyDown Then
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyUp Then
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
FaSheng KeyCode
If KeyCode = vbKeyF1 Then
Text2.Locked = True
Text2.BackColor = &HC0C0C0
End If
If KeyCode = vbKeyF2 Then
Text2.Locked = False
Text2.BackColor = &HFFFFFF
End If
If KeyCode = vbKeyReturn Then
'FaSheng (Text2.Text)
If Text3.Locked = False Then
Text3.SetFocus
Else
If Text4.Locked = False Then
Text4.SetFocus
Else
ROButton1.SetFocus
End If
End If
End If
If KeyCode = vbKeyDown Then
If Data1.Recordset.EOF Then
Data1.Recordset.MoveLast
Else
Data1.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyUp Then
If Data1.Recordset.BOF Then
Data1.Recordset.MoveFirst
Else
Data1.Recordset.MovePrevious
End If
End If
End Sub
Private Sub Text6_GotFocus()
DBGrid1.Visible = False
'DBGrid2.Visible = True
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then
'Text6.Visible = False
'Label7.Visible = False
'DBGrid1.Visible = True
'DBGrid2.Visible = False
'Data1.Recordset.Edit
'Data1.Recordset.MoveNext
DBGrid1.Refresh
Data1.Visible = True
Data2.Visible = False
'Data2.Refresh
If Text6.Text <> "" Then
Data2.Recordset.AddNew
'Else
''Data1.Recordset.Edit
'Data1.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyDown Then
If Data2.Recordset.EOF Then
Data2.Recordset.MoveLast
Else
Data2.Recordset.MoveNext
End If
End If
If KeyCode = vbKeyUp Then
If Data2.Recordset.BOF Then
Data2.Recordset.MoveFirst
Else
Data2.Recordset.MovePrevious
End If
End If
End Sub
Private Sub Text6_LostFocus()
'DBGrid2.Visible = False
'DBGrid1.Visible = True
'Label7.Visible = False
'Text6.Visible = False
End Sub
Private Sub Timer1_Timer()
Text5.Text = DBCombo1.Text
End Sub
Private Sub Timer2_Timer()
Dim a, b As Integer
a = Data2.Recordset.RecordCount
Data2.caption = a
b = Data1.Recordset.RecordCount
Data1.caption = "当前学校共" & b & "位同学。"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -