退卡窗体的敲写还是比较顺利的,并没有像自动下机那样的绞尽脑汁,退卡窗体里并没有什么新鲜的知识点,都是前面窗体里用到的一些语句,此窗体重点在它的应用范围、逻辑梳理、数据更新。这次没有错误集和查询集,就对流程和代码进行分享吧^_^
一、退卡窗体流程图
二、代码片段
①、判断是否有此卡号
txtSQL = "select * from student_Info where cardno='" & txtcardno.Text & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF Then
MsgBox "该卡号未注册,请重新输入!", vbOKOnly, "温馨提示:"
txtcardno.SetFocus
txtcardno.Text = ""
Exit Sub
......
②、判断是否已退卡
If Trim(mrc.Fields(10)) = "不使用" Then
MsgBox "该卡已退卡,请重新输入!", vbOKOnly, "温馨提示:"
txtcardno.SetFocus
txtcardno.Text = ""
Exit Sub
End If
③、判断是否正在上机
oltxtSQL = "select * from Online_Info where cardno='" & txtcardno.Text & "'"
Set olmrc = ExecuteSQL(oltxtSQL, olMsgText)
If Not olmrc.EOF Then
MsgBox "该卡正在上机,请先下机再退卡!", vbOKOnly, "温馨提示:"
Unload Me
frmmain.Show
frmmain.txtcardno = Trim(txtcardno.text)
frmmain.txttype.Text = olmrc.Fields(1)
frmmain.txtstudentno.Text = olmrc.Fields(2)
frmmain.txtstudentName.Text = olmrc.Fields(3)
frmmain.txtdepartment.Text = olmrc.Fields(4)
frmmain.txtsex.Text = olmrc.Fields(5)
frmmain.txtondate.Text = olmrc.Fields(6)
frmmain.txtontime.Text = olmrc.Fields(7)
Exit Sub
End If
以上便是退卡窗体的一些梳理,下一个窗体为用户添加删除窗体,下一站走起^_^