机房收费注册窗体

前言

    机房收费进行了一多半了,刚开始接触时无从下手不懂该从哪开始,里边的功能好多都不知道怎么用,但是静下心来仔细分析几遍或者说自己多点几遍跟同学多交流几次就不成问题了,一个人的力量终究是有限的。

流程图安排:
在这里插入图片描述

'注册存盘代码
Private Sub Command3_Click()
    
    Dim txtsql As String
    Dim msgtext As String
    Dim mrc As ADODB.Recordset
    Dim mrc1 As ADODB.Recordset
    Dim mrc2 As ADODB.Recordset
    Dim filed As String
    
    If Text1.Text = "" Then
        MsgBox "卡号为空,请输入卡号!", 48, "警告"
    Else
        If Not IsNumeric(Text1.Text) Then
            msgBox "请输入数字!", vbOKOnly + vbExclamation, "警告"
            Exit Sub
        Else
            txtsql = "select * from student_info where cardno='" & Text1.Text & "'"
            Set mrc = ExecuteSQL(txtsql, Msgtext)
            
            If mrc.EOF = False Then
               msgBox "此卡号已经存在,您可查询余额!", vbOKOnly + vbExclamation, "警告"
                Text1.SetFocus
                Text1.Text = ""
            Else
                If Not Testtxt(Text2.Text) Then
                    msgBox "请输入充值金额!", 48, "警告"
                    Exit Sub
                End If
                
                txtsql = "select * from basicdata_info"
                Set mrc1 = ExecuteSQL(txtsql, Msgtext)
                     
                    
                    If Val(Text2.Text) < Trim(mrc1.Fields(5)) Then   'Trim(Text10.Text) Then
                        msgBox "充值金额不能小于最少金额!", , "提示"
                        Exit Sub
                    End If
                    
                        If Not Testtxt(Text3.Text) Then
                            msgBox "请输入学号!", 48, "警告"
                            Exit Sub
                        End If
                        
                        If Not Testtxt(Text8.Text) Then
                            msgBox "请输入姓名!", 48, "警告"
                            Exit Sub
                        End If
                        
                        If Not Testtxt(Combo3.Text) Then
                            msgBox "请选择性别!", 48, "警告"
                            Exit Sub
                        End If
                        
                        If Not Testtxt(Text9.Text) Then
                            msgBox "请输入系别!", 48, "警告"
                            Exit Sub
                        End If
    
                        If Not Testtxt(Text5.Text) Then
                            msgBox "请输入年级!", 48, "警告"
                            Exit Sub
                        End If
    
                        If Not Testtxt(Text6.Text) Then
                            msgBox "请输入班级!", 48, "警告"
                            Exit Sub
                        End If
    
                        If Not Testtxt(Combo2.Text) Then
                            msgBox "请选择状态!", 48, "警告"
                            Exit Sub
                        End If
                        
                        If Not Testtxt(Combo1.Text) Then
                            msgBox "请选择类型!", 48, "警告"
                            Exit Sub
                        End If
                        
                        If Not Testtxt(Text10.Text) Then
                            Text7.Text = "无"
                        End If
                        
                        '添加信息
                        txtsql = "select * from student_info"
                        Set mrc2 = ExecuteSQL(txtsql, Msgtext)
                        
                        mrc.AddNew
                        mrc.Fields(0) = Trim(Text1.Text)
                        mrc.Fields(1) = Trim(Text3.Text)
                        mrc.Fields(2) = Trim(Text8.Text)
                        mrc.Fields(3) = Trim(Combo3.Text)
                        mrc.Fields(4) = Trim(Text9.Text)
                        mrc.Fields(5) = Trim(Text5.Text)
                        mrc.Fields(6) = Trim(Text6.Text)
                        mrc.Fields(7) = Trim(Text2.Text)
                        mrc.Fields(8) = Trim(Text7.Text)
                        mrc.Fields(9) = UserName
                        mrc.Fields(10) = Trim(Combo2.Text)
                        mrc.Fields(11) = "未结账"
                        mrc.Fields(12) = Date
                        mrc.Fields(13) = Time
                        mrc.Fields(14) = Trim(Combo1.Text)
                        
                        mrc.Update
                        mrc.Close
                        msgBox "注册成功!", vbOKOnly, "恭喜!"
                        Text1.Text = ""
                        Text2.Text = ""
                        Text3.Text = ""
                        Text8.Text = ""
                        Text9.Text = ""
                        Text5.Text = ""
                        Text6.Text = ""
                        Text7.Text = ""

            End If
        End If
    End If
End Sub


'清空代码
Private Sub Command2_Click()
    Text1.Text = ""
    Text2.Text = ""
    Text3.Text = ""
    Text9.Text = ""
    Text5.Text = ""
    Text6.Text = ""
    Text10.Text = ""
    Text7.Text = ""
End Sub

完事…

发布了53 篇原创文章 · 获赞 6 · 访问量 3344

猜你喜欢

转载自blog.csdn.net/weixin_44031029/article/details/103229577