Modification and optimization of the card return interface
Think carefully about the card refund interface. In fact, you only need to enter the card number and click to withdraw the card. There is no need for such complicated interface settings. The following interface has been redesigned based on the principle of simplicity and simplicity. The main functions have not changed or the theme on the title bar is withdrawn Card.
During the process of entering the card number, the relevant card information will be displayed, such as the date of withdrawal of the card and the time of withdrawal of the card.
The status bar will display whether the current card is in use or has been refunded. If the card has not been refunded, click the OK button to withdraw the card. If the card is successfully withdrawn, a corresponding dialog box will pop up to remind you.
If the card has been refunded, click the OK button and a dialog box will pop up to prompt "This card has been refunded".
The specific code and interface settings are as follows:
Option Explicit Dim txtSQL As String Dim mrc As ADODB.Recordset Dim mrcc As ADODB.Recordset Dim msgtext As String Private Sub Command1_Click() If Text1.Text = "" Then MsgBox "Please enter the card number!", vbOKOnly + vbExclamation, "Warning" Exit Sub End If 'Create a link to the database txtSQL = "select*from cabcelcard_info " Set mrcc = ExecuteSQL(txtSQL, msgtext) 'Determine whether the card has been returned While (mrcc.EOF = False) If Trim(mrcc.Fields(1)) = Trim(Text1.Text) Then MsgBox "This card has been returned!", vbOKOnly + vbExclamation, "Warning" Exit Sub Else mrcc.MoveNext End If Wend 'Write the information of the card to be returned in the database mrcc.AddNew mrcc.Fields(0) = Trim(mrc.Fields(1)) mrcc.Fields(1) = Trim(mrc.Fields(0)) mrcc.Fields(2) = Trim(mrc.Fields(7)) mrcc.Fields(3) = Date mrcc.Fields(4) = Time mrcc.Fields(5) = username mrcc.Fields(6) = "Refunded" mrcc.Update 'Change the status information of the card in the student information sheet txtSQL = "select*from student_info where cardno='" & Text1.Text & "'" Set mrc = ExecuteSQL(txtSQL, msgtext) mrc.Fields(10) = "Refunded" mrc.Update 'The corresponding dialog box will pop up after the card is withdrawn successfully MsgBox "Successful card withdrawal!", vbOKOnly + vbExclamation, "Warning" 'The input box is cleared Text1.Text = "" Exit Sub End Sub Private Sub Text1_Change() 'Connect the student information table in the database txtSQL = "select*from student_Info" Set mrc = ExecuteSQL(txtSQL, msgtext) 'Read the relevant information in the student information sheet While (mrc.EOF = False) If Trim(mrc.Fields(0)) = Trim(Text1.Text) Then 'When the input card number is the same as the student card number in the database Label4.Caption = mrc.Fields(7) 'Student balance display 'Display the relevant information about the current card refund and the status of the card Label3.Caption = "Return card number:" & mrc.Fields(0) & Chr(13) & Chr(13) & "Status:" & mrc.Fields(10) & Chr(13) & Chr(13) & "Refundable Amount:" & mrc.Fields(7) & Chr(13) & Chr(13) & "Student ID:" & mrc.Fields(1) & Chr(13) & Chr(13) & "Name: " & mrc.Fields(2) & Chr(13) & Chr(13) & "Refund Date:" & Date & Chr(13) & Chr(13) & "Refund Time:" & Time & Chr(13 ) & Chr(13) & "Operator:" & username Exit Sub Else mrc.MoveNext 'Query the next message in the table End If Wend End Sub