📄 modteacher.frm
字号:
TabIndex = 25
Top = 555
Width = 1095
End
Begin VB.Label Label3
Caption = "性别:"
Height = 255
Left = 840
TabIndex = 24
Top = 1230
Width = 1095
End
Begin VB.Label Label4
Caption = "职称:"
Height = 375
Left = 3720
TabIndex = 23
Top = 1230
Width = 975
End
Begin VB.Label Label5
Caption = "政治面目:"
Height = 375
Left = 6360
TabIndex = 22
Top = 1270
Width = 1095
End
Begin VB.Label Label6
Caption = "联系电话:"
Height = 375
Left = 840
TabIndex = 21
Top = 1920
Width = 975
End
Begin VB.Label Label7
Caption = "民族:"
Height = 255
Left = 3720
TabIndex = 20
Top = 1875
Width = 1095
End
Begin VB.Label Label8
Caption = "籍贯:"
Height = 375
Left = 6480
TabIndex = 19
Top = 1875
Width = 975
End
Begin VB.Label Label9
Caption = "出生日期:"
Height = 495
Left = 840
TabIndex = 18
Top = 2490
Width = 1095
End
Begin VB.Label Label10
Caption = "参加工作日期:"
Height = 375
Left = 5880
TabIndex = 17
Top = 2490
Width = 1335
End
Begin VB.Label Label11
Caption = "家庭住址:"
Height = 375
Left = 840
TabIndex = 16
Top = 3075
Width = 1095
End
Begin VB.Label Label12
Caption = "备注信息:"
Height = 375
Left = 840
TabIndex = 15
Top = 3840
Width = 1215
End
End
Begin VB.Label Label17
Caption = "Label13"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H000000FF&
Height = 975
Left = 8400
TabIndex = 39
Top = 5640
Width = 2535
End
End
Attribute VB_Name = "modTeacher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MRC As ADODB.Recordset
Dim myBookmark As Variant
Dim mcclean, IsValid, BACK As Boolean
Public DeptID, MajorID As Integer
Public UserID As String
Public Sub dataClear()
Text1.Text = ""
Text2.Text = ""
Combo1.Text = ""
Text4.Text = ""
Combo2.Text = ""
Combo3.Text = ""
Text5.Text = ""
Text6.Text = ""
Text3.Text = ""
Text8.Text = ""
Text7.Text = ""
RichTextBox1.Text = ""
Combo4.Text = ""
Combo5.Text = ""
Frame2.Enabled = False
Frame3.Enabled = False
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Command4.Enabled = False
Command5.Enabled = False
Command6.Enabled = False
Command7.Enabled = False
Command8.Enabled = False
End Sub
Public Sub viewData()
Dim txtSQL As String
Dim MsgText As String
Dim QUE As ADODB.Recordset
Text1.Text = MRC.Fields(0)
UserID = Text1.Text
Text2.Text = MRC.Fields(1)
Combo1.Text = MRC.Fields(2)
Text4.Text = MRC.Fields(3)
Combo2.Text = MRC.Fields(4)
Combo3.Text = MRC.Fields(5)
Text5.Text = MRC.Fields(6)
Text6.Text = MRC.Fields(8)
Text3.Text = MRC.Fields(9)
Text8.Text = MRC.Fields(10)
Text7.Text = MRC.Fields(11)
RichTextBox1.Text = MRC.Fields(12)
txtSQL = "SELECT NationalityName FROM NATIONALITY WHERE NationalityID=" & Text8.Text & ""
Set QUE = ExecuteSQL(txtSQL, MsgText)
Combo4.Text = QUE.Fields(0).Value
txtSQL = "SELECT HomeTownName FROM HOMETOWN WHERE HomeTownID='" & Text7.Text & "'"
Set QUE = ExecuteSQL(txtSQL, MsgText)
Combo5.Text = QUE.Fields(0).Value
End Sub
Private Sub Command5_Click()
IsValid = True
End Sub
Private Sub Command6_Click()
Dim DelSQL As String
Dim DelMsg As String
Dim DEL As ADODB.Recordset
Dim insSQL As String
Dim InsMsg As String
Dim INS As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Dim QUE As ADODB.Recordset
If Not (IsValid) Then
MsgBox "请先请先点击[修改信息]按钮!", vbOKOnly + vbExclamation, "学籍管理系统"
Else
If Not (Testtxt(Text1) And Testtxt(Text2) And Testtxt(Text3) And Testtxt(Text4) And Testtxt(Text5) And Testtxt(Text6) And Testtxt(Combo1) And Testtxt(Combo2) And Testtxt(Combo3) And Testtxt(Text8) And Testtxt(Text7)) Then
MsgBox "请填写完整教师信息!", vbOKOnly + vbExclamation, "学籍管理系统"
Exit Sub
End If
If Not IsDate(Text4) Then
MsgBox "日期的输入的格式为(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
Text4.SetFocus
Text4.Text = ""
Exit Sub
End If
If Not IsDate(Text5) Then
MsgBox "日期的输入的格式为(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
Text5.SetFocus
Text5.Text = ""
Exit Sub
End If
DelSQL = "DELETE FROM USERINFO WHERE UserID='" & UserID & "'"
Set DEL = ExecuteSQL(DelSQL, DelMsg)
txtSQL = "SELECT * FROM USERINFO WHERE Name='" & Text1.Text & "'"
Set QUE = ExecuteSQL(txtSQL, MsgText)
If Not (QUE.EOF) Then
MsgBox "数据库中已经存在教师编号为[" & Text1.Text & "]的记录,请查证后重新填写!", vbOKOnly + vbExclamation, "学籍管理系统"
Text1.Text = ""
Exit Sub
End If
If (RichTextBox1.Text = "") Then
RichTextBox1.Text = " "
End If
insSQL = "INSERT INTO USERINFO VALUES('" & Text1.Text & "','" & Text2.Text & "','" & Combo1.Text & "','" & Text4.Text & "','" & Combo2.Text & "','" & Combo3.Text & "','" & Text5.Text & "'," & DeptID & ",'" & Text6.Text & "','" & Text3.Text & "'," & Text8.Text & "," & Text7.Text & ",'" & RichTextBox1.Text & "')"
Set INS = ExecuteSQL(insSQL, InsMsg)
If (InsMsg = "INSERT query successful") Then
MsgBox "数据修改完毕!", vbOKOnly + vbInformation, "学籍管理系统"
End If
End If
IsValid = False
txtSQL = "SELECT * FROM USERINFO WHERE DeptID=" & DeptID & " "
Set MRC = ExecuteSQL(txtSQL, MsgText)
End Sub
Private Sub Command9_Click()
If (BACK) Then
Unload Me
getDept.Show
Else
Unload Me
Unload getDept
End If
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
Dim txtSQL1 As String
Dim Msgtext1 As String
Dim txtSQL2 As String
Dim Msgtext2 As String
Dim mrcA As ADODB.Recordset
Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
Me.Caption = "修改(" & getDept.Combo1.Text & ")教师信息"
Label17.Caption = "浏览[" & getDept.Combo1.Text & "]教师信息,并可以对教师信息进行删除和修改操作"
txtSQL = "SELECT DeptID FROM DEPARTMENT WHERE DeptName='" & getDept.Combo1.Text & "'"
Set mrcA = ExecuteSQL(txtSQL, MsgText)
DeptID = mrcA.Fields(0).Value
txtSQL1 = "SELECT NationalityName FROM NATIONALITY"
Call Module1.DataList(txtSQL1, Combo4)
txtSQL2 = "SELECT HomeTownName FROM HOMETOWN"
Call Module1.DataList(txtSQL2, Combo5)
txtSQL = "SELECT * FROM USERINFO WHERE DeptID=" & DeptID & " "
Set MRC = ExecuteSQL(txtSQL, MsgText)
If Not MRC.EOF Then
MRC.MoveFirst
Call viewData
mcbookmark = MRC.Bookmark
mcclean = True
IsValid = False
Else
MsgBox "表中没有数据!", vbOKOnly + vbExclamation, "学籍管理系统"
Call dataClear
BACK = True
End If
End Sub
Private Sub Command1_Click()
MRC.MoveFirst
Call viewData
End Sub
Private Sub Command2_Click()
MRC.MovePrevious
If MRC.BOF Then
MsgBox "该记录为第一条记录!", vbOKOnly + vbExclamation, "学籍管理系统"
MRC.MoveLast
End If
Call viewData
End Sub
Private Sub Command3_Click()
MRC.MoveNext
If MRC.EOF Then
MsgBox "该记录为最后一条记录!", vbOKOnly + vbExclamation, "学籍管理系统"
MRC.MoveFirst
End If
Call viewData
End Sub
Private Sub Command4_Click()
MRC.MoveLast
Call viewData
End Sub
Private Sub Combo5_Click()
Dim txtSQL As String
Dim MsgText As String
Dim QUE As ADODB.Recordset
txtSQL = "SELECT HomeTownID FROM HOMETOWN WHERE HomeTownName='" & Combo5.Text & "'"
Set QUE = ExecuteSQL(txtSQL, MsgText)
Text7.Text = QUE.Fields(0).Value
End Sub
Private Sub Combo4_Click()
Dim txtSQL As String
Dim MsgText As String
Dim QUE As ADODB.Recordset
txtSQL = "SELECT NationalityID FROM NATIONALITY WHERE NationalityName='" & Combo4.Text & "'"
Set QUE = ExecuteSQL(txtSQL, MsgText)
Text8.Text = QUE.Fields(0).Value
End Sub
Private Sub Command7_Click()
Dim txtSQL As String
Dim MsgText As String
txtSQL = "SELECT * FROM USERINFO WHERE DeptID=" & DeptID & ""
Set MRC = ExecuteSQL(txtSQL, MsgText)
Call Me.viewData
IsValid = False
End Sub
Private Sub Command8_Click()
Dim DelSQL As String
Dim DelMsg As String
Dim DEL As ADODB.Recordset
Dim txtSQL As String
Dim MsgText As String
Dim SEL As ADODB.Recordset
str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
If (vbOK) Then
DelSQL = "DELETE FROM USERINFO WHERE UserID='" & Text1.Text & "'"
Set DEL = ExecuteSQL(DelSQL, DelMsg)
txtSQL = "SELECT * FROM USERINFO WHERE DeptID=" & DeptID & ""
Set SEL = ExecuteSQL(txtSQL, MsgText)
If (SEL.EOF) Then
Call dataClear
MsgBox "表中没有数据!", vbOKOnly + vbExclamation, "学籍管理系统"
Else
MRC.MoveNext
If (MRC.EOF) Then
MRC.MoveFirst
End If
End If
End If
End Sub
Private Sub Calendar1_Click()
Text4.Text = Calendar1.Value
Calendar1.Visible = False
End Sub
Private Sub Calendar2_Click()
Text5.Text = Calendar2.Value
Calendar2.Visible = False
End Sub
Private Sub cmd1_Click()
Calendar1.Visible = True
End Sub
Private Sub cmd2_Click()
Calendar2.Visible = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -