Computer room charges-basic data settings

The basic data form is the first form I think needs to be typed after logging in the computer room charging system, because only the calculated data is clear, then students can go online and offline and the functions of general users can be realized.

For this form,

Control introduction:

1. The hourly charge for fixed users is lower than for temporary users,

2. The increment unit time is charged by the hour, so here is 60 minutes as the increment unit.

3. The basic data table has at least the computer time. This is to prevent the user from finding that he is in an emergency and cannot be on the computer after he comes to the computer. As long as the user gets off the machine within the first two minutes (at least the time of the machine), then the user will not be charged.

4. Since the user informs the operator or administrator at the front desk to help them click on the machine, they can get on the machine. It takes a certain amount of time from the front desk to their seat, so the preparation time is for this. Give users two minutes of preparation time for them to walk to their seats.

5. The minimum amount is to ensure that the card number can be used on the machine normally and the amount can be used to deduct the cost of the machine.

 

Form interface

When the form appears, all data should be displayed, and now the data cannot be changed, and the text box cannot be changed. You can modify it only after you click Modify. At this time, the text box can be modified. When canceling, the control is restored to the unmodifiable state and the data of the control is modified to the set data.

Code part

Private Sub cmdCancel_Click()

    Dim TxtSql As String
    Dim MsgText As String
    Dim mrc As Recordset

    '每个文本框设置不可修改
    Text1.Enabled = False
    Text2.Enabled = False
    Text4.Enabled = False
    Text5.Enabled = False
    Text5.Enabled = False
    Text6.Enabled = False

    '恢复默认数据
    TxtSql = "select * from BasicData_Info "
    Set mrc = ExecuteSQL(TxtSQL, MsgText)
    
      Text1.Text = mrc.Fields(0)  '固定用户收费费用
      Text2.Text = mrc.Fields(1) '临时用户收取费用
      Text3.Text = mrc.Fields(2) '递增单位时间
      Text4.Text = mrc.Fields(3)  '至少上机时间
      Text5.Text = mrc.Fields(4) '准备时间
      Text6.Text = mrc.Fields(5)  '最少金额
      
End Sub

For the modification button, you should first determine whether the content of each text box is filled in, and whether the content of each text box conforms to the format and whether it is duplicated with the source data. All requirements are met and stored in the database.

If Text1.Text = mrc.Fields(0) And Text2.Text = mrc.Fields(1) And Text3.Text = mrc.Fields(2) And _
        Text4.Text = mrc.Fields(3) And Text5.Text = mrc.Fields(4) And Text6.Text = mrc.Fields(5) Then
            MsgBox "什么数据都没有修改", 64, "温馨提示"
Else
    
        mrc.Fields(0) = Trim(Text1.Text) '固定用户收费费用
        mrc.Fields(1) = Trim(Text2.Text) '临时用户收取费用
        mrc.Fields(2) = Trim(Text3.Text) '递增单位时间
        mrc.Fields(3) = Trim(Text4.Text) '至少上机时间
        mrc.Fields(4) = Trim(Text5.Text) '准备时间
        mrc.Fields(5) = Trim(Text6.Text) '最少金额
        mrc.Fields(6) = UserName
        mrc.Fields(7) = Date
        mrc.Fields(8) = Time
        
        mrc.Update
        mrc.Close
        
    MsgBox "修改成功", 64, "温馨提示"
    
End If

For the judgment of the input character limit, I did not put the code on it. This is to test the viewer's own ability, hehe (*^▽^*).

The introduction of this blog is over, let's cheer together~ encourage each other

Guess you like

Origin blog.csdn.net/weixin_44663188/article/details/108068949