📄 frmmodifysinfo.frm
字号:
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 15
Top = 960
Width = 1092
End
Begin VB.Label Label4
Alignment = 2 'Center
Caption = "出生日期"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 4560
TabIndex = 14
Top = 1080
Width = 1092
End
Begin VB.Label Label5
Alignment = 2 'Center
Caption = "班号"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 13
Top = 1560
Width = 1092
End
Begin VB.Label Label6
Alignment = 2 'Center
Caption = "联系电话"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 4560
TabIndex = 12
Top = 1560
Width = 1092
End
Begin VB.Label Label7
Alignment = 2 'Center
Caption = "入校日期"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 120
TabIndex = 11
Top = 2160
Width = 1092
End
Begin VB.Label Label8
Alignment = 2 'Center
Caption = "家庭住址"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 252
Left = 4560
TabIndex = 10
Top = 2160
Width = 1092
End
Begin VB.Label Label9
Alignment = 2 'Center
Caption = "备注"
BeginProperty Font
Name = "宋体"
Size = 10.8
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 372
Left = 120
TabIndex = 9
Top = 2760
Width = 1092
End
End
Attribute VB_Name = "frmModifysinfo"
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 As Boolean
Private Sub editCommand_Click()
mcclean = False
Frame2.Enabled = False
firstCommand.Enabled = False
previousCommand.Enabled = False
nextCommand.Enabled = False
lastCommand.Enabled = False
txtSID.Enabled = True
txtName.Enabled = True
comboSex.Enabled = True
txtBorndate.Enabled = True
comboClassno.Enabled = True
txtRudate.Enabled = True
txtTel.Enabled = True
txtAddress.Enabled = True
txtComment.Enabled = True
myBookmark = mrc.Bookmark
End Sub
Private Sub cancelCommand_Click()
If Not mcclean Then
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtSID.Enabled = False
txtName.Enabled = False
comboSex.Enabled = False
txtBorndate.Enabled = False
comboClassno.Enabled = False
txtRudate.Enabled = False
txtTel.Enabled = False
txtAddress.Enabled = False
txtComment.Enabled = False
mrc.Bookmark = myBookmark
Call viewData
Else
MsgBox "什么都没有修改,有什么好取消的!", vbOKOnly + vbExclamation, "警告"
End If
End Sub
Private Sub deleteCommand_Click()
myBookmark = mrc.Bookmark
str2$ = MsgBox("是否删除当前记录?", vbOKCancel, "删除当前记录")
If str2$ = vbOK Then
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
myBookmark = mrc.Bookmark
mrc.MoveLast
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
Else
myBookmark = mrc.Bookmark
mrc.MovePrevious
mrc.Delete
mrc.Bookmark = myBookmark
Call viewData
End If
Else
mrc.Bookmark = myBookmark
Call viewData
End If
End Sub
Private Sub firstCommand_Click()
mrc.MoveFirst
Call viewData
End Sub
Private Sub Form_Load()
Dim txtSQL As String
Dim MsgText As String
txtSQL = "select * from student_Info "
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.MoveFirst
Call viewData
mcbookmark = mrc.Bookmark
mcclean = True
End Sub
Public Sub viewData()
txtSID.Text = mrc.Fields(0)
txtName.Text = mrc.Fields(1)
comboSex.Text = mrc.Fields(2)
txtBorndate.Text = Format(mrc.Fields(3), "yyyy-mm-dd")
comboClassno.Text = mrc.Fields(4)
txtTel.Text = mrc.Fields(5)
txtRudate.Text = Format(mrc.Fields(6), "yyyy-mm-dd")
txtAddress.Text = mrc.Fields(7)
txtComment.Text = mrc.Fields(8)
End Sub
Private Sub lastCommand_Click()
mrc.MoveLast
Call viewData
End Sub
Private Sub nextCommand_Click()
mrc.MoveNext
If mrc.EOF Then
mrc.MoveFirst
End If
Call viewData
End Sub
Private Sub previousCommand_Click()
mrc.MovePrevious
If mrc.BOF Then
mrc.MoveLast
End If
Call viewData
End Sub
Private Sub updateCommand_Click()
Dim txtSQL As String
Dim MsgText As String
Dim mrcc As ADODB.Recordset
If mcclean Then
MsgBox "请先修改学籍信息", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If Not Testtxt(txtSID.Text) Then
MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
txtSID.SetFocus
Exit Sub
End If
If Not Testtxt(txtName.Text) Then
MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
txtName.SetFocus
Exit Sub
End If
If Not Testtxt(comboSex.Text) Then
MsgBox "请选择性别!", vbOKOnly + vbExclamation, "警告"
comboSex.SetFocus
Exit Sub
End If
If Not Testtxt(txtBorndate.Text) Then
MsgBox "请输入出生日期!", vbOKOnly + vbExclamation, "警告"
txtBorndate.SetFocus
Exit Sub
End If
If Not Testtxt(comboClassno.Text) Then
MsgBox "请选择班号!", vbOKOnly + vbExclamation, "警告"
comboClassno.SetFocus
Exit Sub
End If
If Not Testtxt(txtTel.Text) Then
MsgBox "请输入联系电话!", vbOKOnly + vbExclamation, "警告"
txtTel.SetFocus
Exit Sub
End If
If Not Testtxt(txtRudate.Text) Then
MsgBox "请输入入校日期!", vbOKOnly + vbExclamation, "警告"
txtRudate.SetFocus
Exit Sub
End If
If Not Testtxt(txtAddress.Text) Then
MsgBox "请输入家庭住址!", vbOKOnly + vbExclamation, "警告"
txtAddress.SetFocus
Exit Sub
End If
If Not IsNumeric(Trim(txtSID.Text)) Then
MsgBox "学号请输入数字!", vbOKOnly + vbExclamation, "警告"
txtSID.SetFocus
Exit Sub
End If
mrc.Delete
txtSQL = "select * from student_Info where student_ID = '" & Trim(txtSID.Text) & "'"
Set mrcc = ExecuteSQL(txtSQL, MsgText)
If mrcc.EOF = False Then
MsgBox "学号重复,请重新输入!", vbOKOnly + vbExclamation, "警告"
mrcc.Close
txtSID.SetFocus
Else
mrcc.Close
If Not IsDate(txtBorndate.Text) Then
MsgBox "出生时间应输入日期格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtBorndate.SetFocus
Else
txtBorndate = Format(txtBorndate, "yyyy-mm-dd")
If Not IsDate(txtRudate.Text) Then
MsgBox "入校时间应输入日期格式(yyyy-mm-dd)!", vbOKOnly + vbExclamation, "警告"
txtRudate.SetFocus
Else
txtRudate = Format(txtRudate, "yyyy-mm-dd")
mrc.AddNew
mrc.Fields(0) = Trim(txtSID.Text)
mrc.Fields(1) = Trim(txtName.Text)
mrc.Fields(2) = Trim(comboSex.Text)
mrc.Fields(3) = Trim(txtBorndate.Text)
mrc.Fields(4) = Trim(comboClassno.Text)
mrc.Fields(5) = Trim(txtTel.Text)
mrc.Fields(6) = Trim(txtRudate.Text)
mrc.Fields(7) = Trim(txtAddress.Text)
mrc.Fields(8) = Trim(txtComment.Text)
mrc.Update
MsgBox "修改学籍信息成功!", vbOKOnly + vbExclamation, "修改学籍信息"
mrc.Bookmark = myBookmark
Call viewData
Frame2.Enabled = True
firstCommand.Enabled = True
previousCommand.Enabled = True
nextCommand.Enabled = True
lastCommand.Enabled = True
txtSID.Enabled = False
txtName.Enabled = False
comboSex.Enabled = False
txtBorndate.Enabled = False
comboClassno.Enabled = False
txtRudate.Enabled = False
txtTel.Enabled = False
txtAddress.Enabled = False
txtComment.Enabled = False
mcclean = True
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -