📄 frmstudentg.frm
字号:
AutoSize = -1 'True
Caption = "毕业学校"
Height = 180
Index = 8
Left = 3720
TabIndex = 38
Top = 1020
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "专业"
Height = 180
Index = 7
Left = 240
TabIndex = 37
Top = 1383
Width = 360
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "已持有证书"
Height = 180
Index = 6
Left = 2640
TabIndex = 36
Top = 1380
Width = 900
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "工作状态"
Height = 180
Index = 5
Left = 4800
TabIndex = 35
Top = 1380
Width = 720
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "身份证号"
Height = 180
Index = 20
Left = 240
TabIndex = 34
Top = 1022
Width = 720
End
End
Begin MSFlexGridLib.MSFlexGrid MSFlxStuInfo
Height = 2055
Left = 120
TabIndex = 27
Top = 120
Width = 6975
_ExtentX = 12303
_ExtentY = 3625
_Version = 393216
Rows = 3
Cols = 21
FixedRows = 2
FocusRect = 0
SelectionMode = 1
AllowUserResizing= 1
End
Begin VB.CommandButton cmdAdd
Caption = "添加(&A)"
Enabled = 0 'False
Height = 350
Left = 3849
TabIndex = 2
ToolTipText = "添加新学员"
Top = 2280
Width = 780
End
Begin VB.CommandButton cmdDel
Caption = "删除(&D)"
Enabled = 0 'False
Height = 350
Left = 4671
TabIndex = 3
ToolTipText = "删除学员"
Top = 2280
Width = 780
End
Begin VB.CommandButton cmdModi
Caption = "修改(&M)"
Enabled = 0 'False
Height = 350
Left = 5493
TabIndex = 4
ToolTipText = "修改学员信息"
Top = 2280
Width = 780
End
Begin VB.CommandButton cmdSave
Caption = "保存(&S)"
Height = 350
Left = 4800
TabIndex = 26
ToolTipText = "保存并退出"
Top = 7200
Width = 1020
End
Begin VB.CommandButton cmdClose
Caption = "关闭(&C)"
Height = 350
Left = 6000
TabIndex = 28
ToolTipText = "关闭"
Top = 7200
Width = 1020
End
Begin VB.CommandButton cmdQuery
Caption = "查询(&Q)"
Height = 350
Left = 3027
TabIndex = 1
ToolTipText = "按查询条件查询"
Top = 2280
Width = 780
End
End
Attribute VB_Name = "frmStudentG"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public strSearch As String
Dim IfAdd As Boolean
Dim IfSave As Boolean
Dim Pri As New ADODB.Recordset
Private Sub cmdAdd_Click()
If IfSave = False Then
If MsgBox("数据未保存,是否保存现有数据?", vbInformation + vbYesNo, "保存") = vbYes Then
Call cmdSaveInfo_Click '保存
Else
fraStuInfo.Enabled = False
txtStuNo.Enabled = False
IfSave = True
End If
End If
IfSave = False '按下添加后声明存在需要保存数据
fraStuInfo.Enabled = True
txtStuNo.Enabled = True
cmdSaveInfo.Enabled = True
Call Init '初始化控件
IfAdd = True '判断按的是添加按扭还是修改按扭
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdDel_Click()
Dim I As Integer
If MsgBox("数据删除后将不能恢复,是否删除?", vbInformation + vbYesNo, "删除数据") = vbYes Then ''dfgsdfghsdfgsdgfsdfg
MsflxStuInfo.Col = 1
If Pri.EOF = True And Pri.BOF = True Then
Else
Pri.MoveFirst
End If
Pri.Find "studentno='" & MsflxStuInfo.Text & "'", , adSearchForward
If Pri.EOF = True Then
If Rst.EOF = True And Rst.BOF = True Then
Else
Rst.MoveFirst
End If
Rst.Find "studentno='" & MsflxStuInfo.Text & "'", , adSearchForward
If Rst.EOF <> True Then
Rst.Delete
End If
If MsflxStuInfo.Rows > 3 Then
MsflxStuInfo.RemoveItem MsflxStuInfo.Row
Else
If MsflxStuInfo.Row = 2 Then
For I = 0 To 20
MsflxStuInfo.Col = I
MsflxStuInfo.Text = ""
Next I
End If
End If
Else
MsgBox "记录不能删除,因为在学生成绩表中存在引用。", vbInformation + vbOKOnly, "删除记录失败"
End If
End If
End Sub
Private Sub cmdSave_Click()
On Error GoTo Err
If IfSave = False Then
If MsgBox("存在未保存数据,是否保存现有数据?", vbInformation + vbYesNo, "保存") = vbYes Then
Call cmdSaveInfo_Click
End If
End If
Dim intIndex As Integer
If Rst.EOF = True And Rst.BOF = True Then
Else
Rst.MoveFirst
End If
MsflxStuInfo.Row = MsflxStuInfo.Rows - 1
MsflxStuInfo.Col = 1
If MsflxStuInfo.Text <> "" Then
For intIndex = 2 To MsflxStuInfo.Rows - 1
MsflxStuInfo.Row = intIndex
MsflxStuInfo.Col = 1
Rst.Find "studentno='" & MsflxStuInfo.Text & "'", , adSearchForward '查找记录集中是否已有此记录
If Rst.EOF = True Then
Rst.AddNew
End If
Rst.Fields("studentNo") = MsflxStuInfo.Text
MsflxStuInfo.Col = 2
Rst.Fields("name") = MsflxStuInfo.Text
MsflxStuInfo.Col = 3
Rst.Fields("py") = MsflxStuInfo.Text
MsflxStuInfo.Col = 4
Rst.Fields("sex") = MsflxStuInfo.Text
MsflxStuInfo.Col = 5
Rst.Fields("identityno") = MsflxStuInfo.Text
MsflxStuInfo.Col = 6
Rst.Fields("classno") = MsflxStuInfo.Text
MsflxStuInfo.Col = 7
Rst.Fields("school") = MsflxStuInfo.Text
MsflxStuInfo.Col = 8
Rst.Fields("degree") = MsflxStuInfo.Text
MsflxStuInfo.Col = 9
Rst.Fields("specialty") = MsflxStuInfo.Text
MsflxStuInfo.Col = 10
Rst.Fields("certificate") = MsflxStuInfo.Text
MsflxStuInfo.Col = 11
Rst.Fields("jobstatus") = MsflxStuInfo.Text
MsflxStuInfo.Col = 12
Rst.Fields("jobunit") = MsflxStuInfo.Text
MsflxStuInfo.Col = 13
Rst.Fields("jobtype") = MsflxStuInfo.Text
MsflxStuInfo.Col = 14
Rst.Fields("address") = MsflxStuInfo.Text
MsflxStuInfo.Col = 15
Rst.Fields("maincode") = MsflxStuInfo.Text
MsflxStuInfo.Col = 16
Rst.Fields("tel") = MsflxStuInfo.Text
MsflxStuInfo.Col = 17
Rst.Fields("tocity") = MsflxStuInfo.Text
MsflxStuInfo.Col = 18
Rst.Fields("topost") = MsflxStuInfo.Text
MsflxStuInfo.Col = 19
Rst.Fields("status") = MsflxStuInfo.Text
MsflxStuInfo.Col = 20
Rst.Fields("remark") = MsflxStuInfo.Text
Rst.Update
Rst.MoveNext
Next intIndex
End If
MsgBox "数据保存成功", vbInformation + vbOKOnly, "保存"
Unload Me
Exit Sub
Err:
MsgBox Err.Number & Err.Description
Resume Next
End Sub
Private Sub cmdSaveInfo_Click()
Dim intIndex As Integer
For intIndex = 2 To MsflxStuInfo.Rows - 1
MsflxStuInfo.Col = 1
If txtStuNo = MsflxStuInfo.Text And IfAdd = True Then
MsgBox "记录已经存在!", vbInformation + vbOKOnly, "数据重复"
Exit Sub
End If
Next intIndex
If txtStuNo <> "" And txtStuName <> "" And txtStuNamePY <> "" _
And txtMaincode <> "" And txtAddress <> "" And txtTel <> "" Then
If txtIdentity Like "[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" _
Or txtIdentity Like "[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]" Then
cmdSaveInfo.Enabled = False
MsflxStuInfo.Row = 2
MsflxStuInfo.Col = 1
If IfAdd And MsflxStuInfo.Text <> "" Then '当列表中存在记录且按下了新增按扭时新增一行
MsflxStuInfo.AddItem Empty
MsflxStuInfo.Row = MsflxStuInfo.Rows - 1
MsflxStuInfo.Col = 0
MsflxStuInfo.Text = MsflxStuInfo.Row - 1
End If
MsflxStuInfo.Col = 1
MsflxStuInfo.Text = txtStuNo
MsflxStuInfo.Col = 2
MsflxStuInfo.Text = txtStuName
MsflxStuInfo.Col = 3
MsflxStuInfo.Text = txtStuNamePY
MsflxStuInfo.Col = 4
MsflxStuInfo.Text = cmbSex.Text
MsflxStuInfo.Col = 5
MsflxStuInfo.Text = txtIdentity
MsflxStuInfo.Col = 6
MsflxStuInfo.Text = cmbClassNo.Text
MsflxStuInfo.Col = 7
If txtSchool <> "" Then
MsflxStuInfo.Text = txtSchool
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 8
MsflxStuInfo.Text = cmbDegree.Text
MsflxStuInfo.Col = 9
If txtSpecialty <> "" Then
MsflxStuInfo.Text = txtSpecialty
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 10
MsflxStuInfo.Text = cmbCertificate.Text
MsflxStuInfo.Col = 11
MsflxStuInfo.Text = cmbJobStatus.Text
MsflxStuInfo.Col = 12
If txtJobUnit <> "" Then '工作单位不是必题字段
MsflxStuInfo.Text = txtJobUnit
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 13
If txtJobType <> "" Then
MsflxStuInfo.Text = txtJobType
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 14
MsflxStuInfo.Text = txtAddress
MsflxStuInfo.Col = 15
MsflxStuInfo.Text = txtMaincode
MsflxStuInfo.Col = 16
MsflxStuInfo.Text = txtTel
MsflxStuInfo.Col = 17
If txtToCity <> "" Then
MsflxStuInfo.Text = txtToCity
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 18
If txtToPost <> "" Then
MsflxStuInfo.Text = txtToPost
Else
MsflxStuInfo.Text = Empty
End If
MsflxStuInfo.Col = 19
MsflxStuInfo.Text = cmbStatus.Text
MsflxStuInfo.Col = 20
If txtRemark <> "" Then
MsflxStuInfo.Text = txtRemark
Else
MsflxStuInfo.Text = Empty
End If
IfAdd = False
IfSave = True '声明数据已保存在msflxstuinfo中
fraStuInfo.Enabled = False
txtStuNo.Enabled = False
Else
MsgBox "你的身份证号码输入有误,请重新输入!", vbInformation + vbOKOnly, "数据不完整"
txtIdentity.SetFocus
End If
Else
MsgBox "请输入完整信息", vbInformation + vbOKOnly, "数据不完整"
End If
End Sub
Private Sub cmdModi_Click()
If IfSave = False Then
If MsgBox("数据未保存,是否保存现有数据?", vbInformation + vbYesNo, "保存") = vbYes Then
Call cmdSaveInfo_Click
Else
fraStuInfo.Enabled = False
txtStuNo.Enabled = False
IfSave = True
End If
End If
IfSave = False '声明有数据需要保存
fraStuInfo.Enabled = True
cmdSaveInfo.Enabled = True
End Sub
Private Sub cmdQuery_Click()
Dim intIndex As Integer
'在查询前清空所有记录
Do While MsflxStuInfo.Rows > 3
MsflxStuInfo.RemoveItem MsflxStuInfo.Rows - 1
Loop
MsflxStuInfo.Row = 2
For intIndex = 0 To 20
MsflxStuInfo.Col = intIndex
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -