这个窗体有两个大功能所以分开来写~~~
Private Sub cmdUp_Click()
Dim mrc As ADODB.Recordset
Dim MsgText As String
Dim txtsql As String
Dim mrc1 As ADODB.Recordset
Dim MsgText1 As String
Dim txtSQL1 As String
txtDownDate.Text = ""
Downtime.Text = ""
txtConsumptionTime.Text = ""
txtMoney.Text = ""
If Trim(txtCardNumber.Text = "") Then
MsgBox "卡号为空,请输入卡号!", vbOKOnly + vbExclamation, "警告"
txtCardNumber.SetFocus
Else
txtsql = "select * from student_Info where cardno ='" & txtCardNumber.Text & "'"
Set mrc = ExecuteSQL(txtsql, MsgText)
If mrc.EOF Then
MsgBox "没有当前卡号,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtCardNumber.Text = ""
txtMoney.Text = ""
txtCardNumber.SetFocus
Else
txtSQL1 = "select * from OnLine_Info where cardno ='" & txtCardNumber.Text & "'"
Set mrc1 = ExecuteSQL(txtSQL1, MsgText1)
mrc1.AddNew
mrc1.Fields(0) = mrc.Fields(0)
mrc1.Fields(1) = mrc.Fields(14)
mrc1.Fields(2) = mrc.Fields(1)
mrc1.Fields(3) = mrc.Fields(2)
mrc1.Fields(4) = mrc.Fields(4)
mrc1.Fields(5) = mrc.Fields(3)
mrc1.Fields(6) = Date
mrc1.Fields(7) = Time
mrc1.Fields(8) = mrc.Fields(7)
txtStudentID.Text = mrc1.Fields(2)
txtName.Text = mrc1.Fields(3)
txtType.Text = mrc1.Fields(1)
txtSystem.Text = mrc1.Fields(4)
txtSex.Text = mrc1.Fields(5)
txtBoardingRecord.Text = Date
txtBoardingTime.Text = Time
txtBalance.Text = mrc1.Fields(8)
End If
End If
End Sub