第一次机房收费系统之操作员组合查询

对于学生信息维护、查询上机记录、以及操作员工的记录三个窗体都用了组合查询的方法,操作相同,因此在这就不全部介绍了,仅仅介绍一下组合查询的方法,以及代码等,对这三个窗体的具体操作也不做过多的介绍。
这三个窗体的组合查询我是这样理解的,最开始只有条件一可以输入,另外两个条件不可输入,之后两个条件时,条件1、2可用,条件3不可输入,三个条件的时候都可输入,之后根据条件进行查询记录。
这里有一个优化的内容,就是对于不同的字段,输入类型以及输入的字段长度,以及显示不同比如
1.显示卡号、姓名等等:

Private Sub txtInquery2_KeyPress(KeyAscii As Integer)
    If comboFieldName2.Text = "卡号" Then
        If KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) Then
            KeyAscii = 0 '不可输入值
        End If
    Else
        If comboFieldName2.Text = "消费金额" Or comboFieldName2.Text = "余额" Then
            If KeyAscii <> 8 And (KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> Asc(".") Then
                KeyAscii = 0 '不可输入值
            End If
        Else
            If comboFieldName2.Text = "姓名" Then
                If ((KeyAscii <= -3652 And KeyAscii >= -20319) Or (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or KeyAscii = 32 Or KeyAscii = 8) = False Then
                    KeyAscii = 0 '不可输入值
                End If
            End If
        End If
    End If
End Sub

2.对于日期时间
添加新的时间控件,根据不同字段显示和隐藏控件,由于代码在整体中无法弄出,请见下面的组合查询代码

具体组合查询代码如下:

一层查询:

Public Sub OneInquery()
    '对line_info表操作
    Dim mrcline As ADODB.Recordset '用于存放记录集
    Dim lineSQL As String '用于存放SQL语句
    Dim lineMsgText As String '用于存放返回信息
    
    lineSQL = "select * from line_info where status='正常下机' and "
    '限制控件不为空
    If comboFieldName1.Text = "" Then
        MsgBox "请选择字段名!", vbOKOnly + vbExclamation, "警告"
        comboFieldName1.SetFocus
        Exit Sub
    Else
        If comboChar1.Text = "" Then
            MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
            comboChar1.SetFocus
            Exit Sub
        Else
            If comboFieldName1.Text = "卡号" Or comboFieldName1.Text = "消费金额" Or comboFieldName1.Text = "余额" _
                Or comboFieldName1.Text = "姓名" Or comboFieldName1.Text = "备注" Then
                If txtInquery1.Text = "" Then
                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    txtInquery1.SetFocus
                    Exit Sub
                Else
                    lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) _
                              & "'" & Trim(txtInquery1.Text) & "'"
                    Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                    '判断LINE表是否存在记录
                    If mrcline.EOF = True Then
                        MSHFlexGrid.Clear
                        With MSHFlexGrid
                            .Rows = 1
                            .CellAlignment = 4
                            .TextMatrix(0, 0) = "卡号"
                            .TextMatrix(0, 1) = "姓名"
                            .TextMatrix(0, 2) = "上机日期"
                            .TextMatrix(0, 3) = "上机时间"
                            .TextMatrix(0, 4) = "下机日期"
                            .TextMatrix(0, 5) = "下机时间"
                            .TextMatrix(0, 6) = "消费金额"
                            .TextMatrix(0, 7) = "余额"
                            .TextMatrix(0, 8) = "备注"
                        End With
                        MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                        comboFieldName1.SetFocus
                        Exit Sub
                    Else
                        With MSHFlexGrid
                            .Rows = 1
                            Do While mrcline.EOF = False
                                .Rows = .Rows + 1
                                .CellAlignment = 4
                                .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                mrcline.MoveNext
                            Loop
                            mrcline.Close
                         End With
                    End If
                End If
            Else
                If comboFieldName1.Text = "上机日期" Or comboFieldName1.Text = "下机日期" Then
                    If DTPDate1.Value > Date Then
                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                        DTPDate1.SetFocus
                        Exit Sub
                    Else
                    
                        lineSQL = lineSQL & "" & Field(Trim(comboFieldName1.Text)) & "" & Trim(comboChar1.Text) & "'" & Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                             End With
                        End If
                    End If
                Else
                    If comboFieldName1.Text = "上机时间" Or comboFieldName1.Text = "下机时间" Then
                    
                        lineSQL = lineSQL & "" & Field(Trim(comboFieldName1.Text)) & "" & Trim(comboChar1.Text) & "'" & Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                             End With
                        End If
                    End If
                End If
            End If
        End If
    End If
End Sub

二层查询:

Public Sub TwoInquery()
    '对line_info表操作
    Dim mrcline As ADODB.Recordset '用于存放记录集
    Dim lineSQL As String '用于存放SQL语句
    Dim lineMsgText As String '用于存放返回信息
    
    lineSQL = "select * from line_info where status='正常下机' and "
    
    If comboFieldName1.Text = "" Then
        MsgBox "请输入字段名!", vbOKOnly + vbExclamation, "警告"
        comboFieldName1.SetFocus
        Exit Sub
    Else
        If comboChar1.Text = "" Then
            MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
            comboChar1.SetFocus
            Exit Sub
        Else
            If comboFieldName2.Text = "" Then
                MsgBox "请输入字段名!", vbOKOnly + vbExclamation, "警告"
                comboFieldName2.SetFocus
                Exit Sub
            Else
                If comboChar2.Text = "" Then
                    MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
                    comboChar2.SetFocus
                    Exit Sub
                Else
                    If comboFieldName1.Text = "卡号" Or comboFieldName1.Text = "姓名" Or comboFieldName1.Text = "消费金额" Or _
                        comboFieldName1.Text = "余额" Or comboFieldName1.Text = "备注" Then
                        If txtInquery1.Text = "" Then
                            MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                        Else
                            If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" _
                                Or comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
                                If txtInquery2.Text = "" Then
                                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                                Else
                                    lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                              Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                              Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                              Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                    Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                    
                                    If mrcline.EOF = True Then
                                        MSHFlexGrid.Clear
                                        With MSHFlexGrid
                                            .Rows = 1
                                            .CellAlignment = 4
                                            .TextMatrix(0, 0) = "卡号"
                                            .TextMatrix(0, 1) = "姓名"
                                            .TextMatrix(0, 2) = "上机日期"
                                            .TextMatrix(0, 3) = "上机时间"
                                            .TextMatrix(0, 4) = "下机日期"
                                            .TextMatrix(0, 5) = "下机时间"
                                            .TextMatrix(0, 6) = "消费金额"
                                            .TextMatrix(0, 7) = "余额"
                                            .TextMatrix(0, 8) = "备注"
                                        End With
                                        MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                        comboFieldName1.SetFocus
                                        Exit Sub
                                    Else
                                        With MSHFlexGrid
                                            .Rows = 1
                                            Do While mrcline.EOF = False
                                                .Rows = .Rows + 1
                                                .CellAlignment = 4
                                                .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                mrcline.MoveNext
                                            Loop
                                            mrcline.Close
                                         End With
                                     End If
                                End If
                            Else
                                If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then
                                    
                                    If DTPDate2.Value > Date Then
                                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                                        DTPDate2.SetFocus
                                        Exit Sub
                                    Else
                                        lineSQL = lineSQL & "" & Field(Trim(comboFieldName1.Text)) & "" & Trim(comboChar1.Text) & "'" & _
                                                  Trim(txtInquery1.Text) & "'" & "" & Trim(comboGroup1.Text) & " " & _
                                                  Field(Trim(comboFieldName2.Text)) & "" & Trim(comboChar2.Text) & "'" & _
                                                  Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                        
                                        If mrcline.EOF = True Then
                                            MSHFlexGrid.Clear
                                            With MSHFlexGrid
                                                .Rows = 1
                                                .CellAlignment = 4
                                                .TextMatrix(0, 0) = "卡号"
                                                .TextMatrix(0, 1) = "姓名"
                                                .TextMatrix(0, 2) = "上机日期"
                                                .TextMatrix(0, 3) = "上机时间"
                                                .TextMatrix(0, 4) = "下机日期"
                                                .TextMatrix(0, 5) = "下机时间"
                                                .TextMatrix(0, 6) = "消费金额"
                                                .TextMatrix(0, 7) = "余额"
                                                .TextMatrix(0, 8) = "备注"
                                            End With
                                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                            comboFieldName1.SetFocus
                                            Exit Sub
                                        Else
                                            With MSHFlexGrid
                                                .Rows = 1
                                                Do While mrcline.EOF = False
                                                    .Rows = .Rows + 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                    mrcline.MoveNext
                                                Loop
                                                mrcline.Close
                                            End With
                                        End If
                                    End If
                                Else
                                    If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                                        lineSQL = lineSQL & "" & Field(Trim(comboFieldName1.Text)) & "" & Trim(comboChar1.Text) & "'" & _
                                                  Trim(txtInquery1.Text) & "'" & "" & Trim(comboGroup1.Text) & "" & _
                                                  Field(Trim(comboFieldName2.Text)) & "" & Trim(comboChar2.Text) & "'" & _
                                                  Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                        
                                        If mrcline.EOF = True Then
                                            MSHFlexGrid.Clear
                                            With MSHFlexGrid
                                                .Rows = 1
                                                .CellAlignment = 4
                                                .TextMatrix(0, 0) = "卡号"
                                                .TextMatrix(0, 1) = "姓名"
                                                .TextMatrix(0, 2) = "上机日期"
                                                .TextMatrix(0, 3) = "上机时间"
                                                .TextMatrix(0, 4) = "下机日期"
                                                .TextMatrix(0, 5) = "下机时间"
                                                .TextMatrix(0, 6) = "消费金额"
                                                .TextMatrix(0, 7) = "余额"
                                                .TextMatrix(0, 8) = "备注"
                                            End With
                                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                            comboFieldName1.SetFocus
                                            Exit Sub
                                        Else
                                            With MSHFlexGrid
                                                .Rows = 1
                                                Do While mrcline.EOF = False
                                                    .Rows = .Rows + 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                    mrcline.MoveNext
                                                Loop
                                                mrcline.Close
                                            End With
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    Else
                        If comboFieldName1.Text = "上机日期" Or comboFieldName1.Text = "下机日期" Then
                            If DTPDate1.Value > Date Then
                                MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                                DTPDate1.SetFocus
                                Exit Sub
                            Else
                                If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" _
                                    Or comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
                                    If txtInquery2.Text = "" Then
                                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                                    Else
                                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                                  Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                        
                                        If mrcline.EOF = True Then
                                            MSHFlexGrid.Clear
                                            With MSHFlexGrid
                                                .Rows = 1
                                                .CellAlignment = 4
                                                .TextMatrix(0, 0) = "卡号"
                                                .TextMatrix(0, 1) = "姓名"
                                                .TextMatrix(0, 2) = "上机日期"
                                                .TextMatrix(0, 3) = "上机时间"
                                                .TextMatrix(0, 4) = "下机日期"
                                                .TextMatrix(0, 5) = "下机时间"
                                                .TextMatrix(0, 6) = "消费金额"
                                                .TextMatrix(0, 7) = "余额"
                                                .TextMatrix(0, 8) = "备注"
                                            End With
                                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                            comboFieldName1.SetFocus
                                            Exit Sub
                                        Else
                                            With MSHFlexGrid
                                                .Rows = 1
                                                Do While mrcline.EOF = False
                                                    .Rows = .Rows + 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                    mrcline.MoveNext
                                                Loop
                                                mrcline.Close
                                             End With
                                        End If
                                    End If
                                Else
                                    If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then
                                        If DTPDate2.Value > Date Then
                                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                                            DTPDate2.SetFocus
                                            Exit Sub
                                        Else
                                            
                                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                            
                                            If mrcline.EOF = True Then
                                                MSHFlexGrid.Clear
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(0, 0) = "卡号"
                                                    .TextMatrix(0, 1) = "姓名"
                                                    .TextMatrix(0, 2) = "上机日期"
                                                    .TextMatrix(0, 3) = "上机时间"
                                                    .TextMatrix(0, 4) = "下机日期"
                                                    .TextMatrix(0, 5) = "下机时间"
                                                    .TextMatrix(0, 6) = "消费金额"
                                                    .TextMatrix(0, 7) = "余额"
                                                    .TextMatrix(0, 8) = "备注"
                                                End With
                                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                                comboFieldName1.SetFocus
                                                Exit Sub
                                            Else
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    Do While mrcline.EOF = False
                                                        .Rows = .Rows + 1
                                                        .CellAlignment = 4
                                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                        mrcline.MoveNext
                                                    Loop
                                                    mrcline.Close
                                                End With
                                            End If
                                        End If
                                    Else
                                        If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                                        
                                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                            
                                            If mrcline.EOF = True Then
                                                MSHFlexGrid.Clear
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(0, 0) = "卡号"
                                                    .TextMatrix(0, 1) = "姓名"
                                                    .TextMatrix(0, 2) = "上机日期"
                                                    .TextMatrix(0, 3) = "上机时间"
                                                    .TextMatrix(0, 4) = "下机日期"
                                                    .TextMatrix(0, 5) = "下机时间"
                                                    .TextMatrix(0, 6) = "消费金额"
                                                    .TextMatrix(0, 7) = "余额"
                                                    .TextMatrix(0, 8) = "备注"
                                                End With
                                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                                comboFieldName1.SetFocus
                                                Exit Sub
                                            Else
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    Do While mrcline.EOF = False
                                                        .Rows = .Rows + 1
                                                        .CellAlignment = 4
                                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                        mrcline.MoveNext
                                                    Loop
                                                    mrcline.Close
                                                End With
                                            End If
                                        End If
                                    End If
                                End If
                            End If
                        Else
                            If comboFieldName1.Text = "上机时间" Or comboFieldName1.Text = "下机时间" Then
                                If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" _
                                    Or comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
                                    If txtInquery2.Text = "" Then
                                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                                    Else
                                        lineSQL = lineSQL & "" & Field(Trim(comboFieldName1.Text)) & "" & Trim(comboChar1.Text) & "'" & _
                                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & "" & Trim(comboGroup1.Text) & "" & _
                                                  Field(Trim(comboFieldName2.Text)) & "" & Trim(comboChar2.Text) & "'" & _
                                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                        
                                        If mrcline.EOF = True Then
                                            MSHFlexGrid.Clear
                                            With MSHFlexGrid
                                                .Rows = 1
                                                .CellAlignment = 4
                                                .TextMatrix(0, 0) = "卡号"
                                                .TextMatrix(0, 1) = "姓名"
                                                .TextMatrix(0, 2) = "上机日期"
                                                .TextMatrix(0, 3) = "上机时间"
                                                .TextMatrix(0, 4) = "下机日期"
                                                .TextMatrix(0, 5) = "下机时间"
                                                .TextMatrix(0, 6) = "消费金额"
                                                .TextMatrix(0, 7) = "余额"
                                                .TextMatrix(0, 8) = "备注"
                                            End With
                                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                            comboFieldName1.SetFocus
                                            Exit Sub
                                        Else
                                            With MSHFlexGrid
                                                .Rows = 1
                                                Do While mrcline.EOF = False
                                                    .Rows = .Rows + 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                    mrcline.MoveNext
                                                Loop
                                                mrcline.Close
                                             End With
                                        End If
                                    End If
                                Else
                                    If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then

                                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                                  Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                        
                                        If mrcline.EOF = True Then
                                            MSHFlexGrid.Clear
                                            With MSHFlexGrid
                                                .Rows = 1
                                                .CellAlignment = 4
                                                .TextMatrix(0, 0) = "卡号"
                                                .TextMatrix(0, 1) = "姓名"
                                                .TextMatrix(0, 2) = "上机日期"
                                                .TextMatrix(0, 3) = "上机时间"
                                                .TextMatrix(0, 4) = "下机日期"
                                                .TextMatrix(0, 5) = "下机时间"
                                                .TextMatrix(0, 6) = "消费金额"
                                                .TextMatrix(0, 7) = "余额"
                                                .TextMatrix(0, 8) = "备注"
                                            End With
                                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                            comboFieldName1.SetFocus
                                            Exit Sub
                                        Else
                                            With MSHFlexGrid
                                                .Rows = 1
                                                Do While mrcline.EOF = False
                                                    .Rows = .Rows + 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                    mrcline.MoveNext
                                                Loop
                                                mrcline.Close
                                            End With
                                        End If
                                    Else
                                        If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                                                    
                                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                                      Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'"
                                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                                            
                                            If mrcline.EOF = True Then
                                                MSHFlexGrid.Clear
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    .CellAlignment = 4
                                                    .TextMatrix(0, 0) = "卡号"
                                                    .TextMatrix(0, 1) = "姓名"
                                                    .TextMatrix(0, 2) = "上机日期"
                                                    .TextMatrix(0, 3) = "上机时间"
                                                    .TextMatrix(0, 4) = "下机日期"
                                                    .TextMatrix(0, 5) = "下机时间"
                                                    .TextMatrix(0, 6) = "消费金额"
                                                    .TextMatrix(0, 7) = "余额"
                                                    .TextMatrix(0, 8) = "备注"
                                                End With
                                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                                comboFieldName1.SetFocus
                                                Exit Sub
                                            Else
                                                With MSHFlexGrid
                                                    .Rows = 1
                                                    Do While mrcline.EOF = False
                                                        .Rows = .Rows + 1
                                                        .CellAlignment = 4
                                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                                        mrcline.MoveNext
                                                    Loop
                                                    mrcline.Close
                                                End With
                                            End If
                                        End If
                                    End If
                                End If
                            End If 'combofieldname1选中上下机时间
                        End If 'combofieldname1选中上下机日期
                    End If 'combofieldname1选中卡号、姓名等
                End If
            End If
        End If
    End If
End Sub

三层查询

Public Sub ThreeInquery()
    If comboFieldName1.Text = "" Then
        MsgBox "请选择字段名!", vbOKOnly + vbExclamation, "警告"
        comboFieldName1.SetFocus
        Exit Sub
    Else
        If comboChar1.Text = "" Then
            MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
            comboChar1.SetFocus
            Exit Sub
        Else
            If comboFieldName2.Text = "" Then
                MsgBox "请选择字段名!", vbOKOnly + vbExclamation, "警告"
                comboFieldName2.SetFocus
                Exit Sub
            Else
                If comboChar2.Text = "" Then
                    MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
                    comboChar2.SetFocus
                    Exit Sub
                Else
                    If comboFieldName3.Text = "" Then
                        MsgBox "请选择字段名!", vbOKOnly + vbExclamation, "警告"
                        comboFieldName1.SetFocus
                        Exit Sub
                    Else
                        If comboChar3.Text = "" Then
                            MsgBox "请选择操作符!", vbOKOnly + vbExclamation, "警告"
                            comboChar1.SetFocus
                            Exit Sub
                        Else
                            If comboFieldName1.Text = "卡号" Or comboFieldName1.Text = "姓名" Or comboFieldName1.Text = "消费金额" Or _
                                comboFieldName1.Text = "余额" Or comboFieldName1.Text = "备注" Then
                                If txtInquery1.Text = "" Then
                                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                                Else
                                    Call Choose1
                                End If
                            Else
                                If comboFieldName1.Text = "上机日期" Or comboFieldName1.Text = "下机日期" Then
                                    If DTPDate1.Value > Date Then
                                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                                        DTPDate1.SetFocus
                                        Exit Sub
                                    Else
                                        Call Choose2
                                    End If
                                Else
                                    If comboFieldName1.Text = "上机时间" Or comboFieldName1.Text = "下机时间" Then
                                        Call Choose3
                                    End If 'combofieldname1选择上下机时间等
                                End If 'combofieldname1选择上下机日期等
                            End If 'combofieldname1选择卡号、姓名等
                        End If
                    End If
                End If
            End If
        End If
    End If
End Sub
Public Sub Choose1()
    '对line_info表操作
    Dim mrcline As ADODB.Recordset '用于存放记录集
    Dim lineSQL As String '用于存放SQL语句
    Dim lineMsgText As String '用于存放返回信息
    
    lineSQL = "select * from line_info where status='正常下机' and "
    
    If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" Or _
        comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
        If txtInquery2.Text = "" Then
            MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
        Else
            If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                If txtInquery3.Text = "" Then
                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                Else
                    lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                              Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                              Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                              Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                              " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                              " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                               & " " & "status = '正常下机'"
                    Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                    
                    If mrcline.EOF = True Then
                        MSHFlexGrid.Clear
                        With MSHFlexGrid
                            .Rows = 1
                            .CellAlignment = 4
                            .TextMatrix(0, 0) = "卡号"
                            .TextMatrix(0, 1) = "姓名"
                            .TextMatrix(0, 2) = "上机日期"
                            .TextMatrix(0, 3) = "上机时间"
                            .TextMatrix(0, 4) = "下机日期"
                            .TextMatrix(0, 5) = "下机时间"
                            .TextMatrix(0, 6) = "消费金额"
                            .TextMatrix(0, 7) = "余额"
                            .TextMatrix(0, 8) = "备注"
                        End With
                        MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                        Exit Sub
                    Else
                        With MSHFlexGrid
                            .Rows = 1
                            Do While mrcline.EOF = False
                                .Rows = .Rows + 1
                                .CellAlignment = 4
                                .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                mrcline.MoveNext
                            Loop
                            mrcline.Close
                        End With
                    End If
                End If
            Else
                If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                    If DTPDate3.Value > Date Then
                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                        DTPDate3.SetFocus
                        Exit Sub
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
            
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                    
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If 'combofieldname3选择上下机时间等
                End If 'combofieldname3选择上下机日期等
            End If 'combofieldname3选择卡号、姓名等
        End If
    Else
        If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then
            If DTPDate2.Value > Date Then
                MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                DTPDate3.SetFocus
                Exit Sub
            Else
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If
        Else
            If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(txtInquery1.Text) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If 'combofieldname2选择上下机时间等
        End If 'combofieldname2选择上下机日期等
    End If 'combofieldname2选择卡号、姓名等
End Sub
Public Sub Choose2()
    '对line_info表操作
    Dim mrcline As ADODB.Recordset '用于存放记录集
    Dim lineSQL As String '用于存放SQL语句
    Dim lineMsgText As String '用于存放返回信息
    
    lineSQL = "select * from line_info where status='正常下机' and "
    
    If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" Or _
        comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
        If txtInquery2.Text = "" Then
            MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
        Else
            If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                If txtInquery3.Text = "" Then
                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                Else
                    lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                              Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                              Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                              Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                              " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                              " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                               & " " & "status = '正常下机'"
                    Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                    
                    If mrcline.EOF = True Then
                        MSHFlexGrid.Clear
                        With MSHFlexGrid
                            .Rows = 1
                            .CellAlignment = 4
                            .TextMatrix(0, 0) = "卡号"
                            .TextMatrix(0, 1) = "姓名"
                            .TextMatrix(0, 2) = "上机日期"
                            .TextMatrix(0, 3) = "上机时间"
                            .TextMatrix(0, 4) = "下机日期"
                            .TextMatrix(0, 5) = "下机时间"
                            .TextMatrix(0, 6) = "消费金额"
                            .TextMatrix(0, 7) = "余额"
                            .TextMatrix(0, 8) = "备注"
                        End With
                        MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                        Exit Sub
                    Else
                        With MSHFlexGrid
                            .Rows = 1
                            Do While mrcline.EOF = False
                                .Rows = .Rows + 1
                                .CellAlignment = 4
                                .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                mrcline.MoveNext
                            Loop
                            mrcline.Close
                        End With
                    End If
                End If
            Else
                If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                    If DTPDate3.Value > Date Then
                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                        DTPDate3.SetFocus
                        Exit Sub
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
            
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                    
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If 'combofieldname3选择上下机时间等
                End If 'combofieldname3选择上下机日期等
            End If 'combofieldname3选择卡号、姓名等
        End If
    Else
        If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then
            If DTPDate2.Value > Date Then
                MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                DTPDate3.SetFocus
                Exit Sub
            Else
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If
        Else
            If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPDate1.Value, "yyyy/MM/dd")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If 'combofieldname2选择上下机时间等
        End If 'combofieldname2选择上下机日期等
    End If 'combofieldname2选择卡号、姓名等
End Sub
Public Sub Choose3()
    '对line_info表操作
    Dim mrcline As ADODB.Recordset '用于存放记录集
    Dim lineSQL As String '用于存放SQL语句
    Dim lineMsgText As String '用于存放返回信息
    
    lineSQL = "select * from line_info where status='正常下机' and "
    
    If comboFieldName2.Text = "卡号" Or comboFieldName2.Text = "姓名" Or comboFieldName2.Text = "消费金额" Or _
        comboFieldName2.Text = "余额" Or comboFieldName2.Text = "备注" Then
        If txtInquery2.Text = "" Then
            MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
        Else
            If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                If txtInquery3.Text = "" Then
                    MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                Else
                    lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                              Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                              Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                              Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                              " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                              " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                               & " " & "status = '正常下机'"
                    Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                    
                    If mrcline.EOF = True Then
                        MSHFlexGrid.Clear
                        With MSHFlexGrid
                            .Rows = 1
                            .CellAlignment = 4
                            .TextMatrix(0, 0) = "卡号"
                            .TextMatrix(0, 1) = "姓名"
                            .TextMatrix(0, 2) = "上机日期"
                            .TextMatrix(0, 3) = "上机时间"
                            .TextMatrix(0, 4) = "下机日期"
                            .TextMatrix(0, 5) = "下机时间"
                            .TextMatrix(0, 6) = "消费金额"
                            .TextMatrix(0, 7) = "余额"
                            .TextMatrix(0, 8) = "备注"
                        End With
                        MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                        Exit Sub
                    Else
                        With MSHFlexGrid
                            .Rows = 1
                            Do While mrcline.EOF = False
                                .Rows = .Rows + 1
                                .CellAlignment = 4
                                .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                mrcline.MoveNext
                            Loop
                            mrcline.Close
                        End With
                    End If
                End If
            Else
                If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                    If DTPDate3.Value > Date Then
                        MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                        DTPDate3.SetFocus
                        Exit Sub
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
            
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                            .Rows = 1
                            .CellAlignment = 4
                            .TextMatrix(0, 0) = "卡号"
                            .TextMatrix(0, 1) = "姓名"
                            .TextMatrix(0, 2) = "上机日期"
                            .TextMatrix(0, 3) = "上机时间"
                            .TextMatrix(0, 4) = "下机日期"
                            .TextMatrix(0, 5) = "下机时间"
                            .TextMatrix(0, 6) = "消费金额"
                            .TextMatrix(0, 7) = "余额"
                            .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                    
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(txtInquery2.Text) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If 'combofieldname3选择上下机时间等
                End If 'combofieldname3选择上下机日期等
            End If 'combofieldname3选择卡号、姓名等
        End If
    Else
        If comboFieldName2.Text = "上机日期" Or comboFieldName2.Text = "下机日期" Then
            If DTPDate2.Value > Date Then
                MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                DTPDate3.SetFocus
                Exit Sub
            Else
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPDate2.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If
        Else
            If comboFieldName2.Text = "上机时间" Or comboFieldName2.Text = "下机时间" Then
                If comboFieldName3.Text = "卡号" Or comboFieldName3.Text = "姓名" Or comboFieldName3.Text = "消费金额" Or _
                    comboFieldName3.Text = "余额" Or comboFieldName3.Text = "备注" Then
                    If txtInquery3.Text = "" Then
                        MsgBox "请输入查询内容!", vbOKOnly + vbExclamation, "警告"
                    Else
                        lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                  Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                  Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                  Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                  " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                  " " & Trim(comboChar3.Text) & "'" & Trim(txtInquery3.Text) & "'" & " " & Field("与") _
                                   & " " & "status = '正常下机'"
                        Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                        
                        If mrcline.EOF = True Then
                            MSHFlexGrid.Clear
                            With MSHFlexGrid
                                .Rows = 1
                                .CellAlignment = 4
                                .TextMatrix(0, 0) = "卡号"
                                .TextMatrix(0, 1) = "姓名"
                                .TextMatrix(0, 2) = "上机日期"
                                .TextMatrix(0, 3) = "上机时间"
                                .TextMatrix(0, 4) = "下机日期"
                                .TextMatrix(0, 5) = "下机时间"
                                .TextMatrix(0, 6) = "消费金额"
                                .TextMatrix(0, 7) = "余额"
                                .TextMatrix(0, 8) = "备注"
                            End With
                            MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                            comboFieldName1.SetFocus
                            Exit Sub
                        Else
                            With MSHFlexGrid
                                .Rows = 1
                                Do While mrcline.EOF = False
                                    .Rows = .Rows + 1
                                    .CellAlignment = 4
                                    .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                    .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                    .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                    .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                    .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                    .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                    .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                    .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                    .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                    mrcline.MoveNext
                                Loop
                                mrcline.Close
                            End With
                        End If
                    End If
                Else
                    If comboFieldName3.Text = "上机日期" Or comboFieldName3.Text = "下机日期" Then
                        If DTPDate3.Value > Date Then
                            MsgBox "日期应小于当前日期!", vbOKOnly + vbCritical, "错误"
                            DTPDate3.SetFocus
                            Exit Sub
                        Else
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPDate3.Value, "yyyy/MM/dd")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If
                    Else
                        If comboFieldName3.Text = "上机时间" Or comboFieldName3.Text = "下机时间" Then
                        
                            lineSQL = lineSQL & " " & Field(Trim(comboFieldName1.Text)) & " " & Trim(comboChar1.Text) & "'" & _
                                      Trim(Format(DTPTime1.Value, "hh:mm:ss")) & "'" & " " & Trim(comboGroup1.Text) & " " & _
                                      Field(Trim(comboFieldName2.Text)) & " " & Trim(comboChar2.Text) & "'" & _
                                      Trim(Format(DTPTime2.Value, "hh:mm:ss")) & "'" & " " & Field("与") & " " & "status = '正常下机'" & _
                                      " " & Trim(comboGroup2.Text) & " " & Field(Trim(comboFieldName3.Text)) & _
                                      " " & Trim(comboChar3.Text) & "'" & Trim(Format(DTPTime3.Value, "hh:mm:ss")) & "'" & " " & Field("与") _
                                       & " " & "status = '正常下机'"
                            Set mrcline = ExecuteSQL(lineSQL, lineMsgText)
                            
                            If mrcline.EOF = True Then
                                MSHFlexGrid.Clear
                                With MSHFlexGrid
                                    .Rows = 1
                                    .CellAlignment = 4
                                    .TextMatrix(0, 0) = "卡号"
                                    .TextMatrix(0, 1) = "姓名"
                                    .TextMatrix(0, 2) = "上机日期"
                                    .TextMatrix(0, 3) = "上机时间"
                                    .TextMatrix(0, 4) = "下机日期"
                                    .TextMatrix(0, 5) = "下机时间"
                                    .TextMatrix(0, 6) = "消费金额"
                                    .TextMatrix(0, 7) = "余额"
                                    .TextMatrix(0, 8) = "备注"
                                End With
                                MsgBox "该条件数据不存在!", vbOKOnly + vbInformation, "提示"
                                comboFieldName1.SetFocus
                                Exit Sub
                            Else
                                With MSHFlexGrid
                                    .Rows = 1
                                    Do While mrcline.EOF = False
                                        .Rows = .Rows + 1
                                        .CellAlignment = 4
                                        .TextMatrix(.Rows - 1, 0) = Trim(mrcline.Fields(1))
                                        .TextMatrix(.Rows - 1, 1) = Trim(mrcline.Fields(3))
                                        .TextMatrix(.Rows - 1, 2) = Trim(mrcline.Fields(6))
                                        .TextMatrix(.Rows - 1, 3) = Trim(mrcline.Fields(7))
                                        .TextMatrix(.Rows - 1, 4) = Trim(mrcline.Fields(8))
                                        .TextMatrix(.Rows - 1, 5) = Trim(mrcline.Fields(9))
                                        .TextMatrix(.Rows - 1, 6) = Trim(mrcline.Fields(11))
                                        .TextMatrix(.Rows - 1, 7) = Trim(mrcline.Fields(12))
                                        .TextMatrix(.Rows - 1, 8) = Trim(mrcline.Fields(13))
                                        mrcline.MoveNext
                                    Loop
                                    mrcline.Close
                                End With
                            End If
                        End If 'combofieldname3选择上下机时间等
                    End If 'combofieldname3选择上下机日期等
                End If 'combofieldname3选择卡号、姓名等
            End If 'combofieldname2选择上下机时间等
        End If 'combofieldname2选择上下机日期等
    End If 'combofieldname2选择卡号、姓名等
End Sub

本来代码没用这么多,但是由于时间控件的输入难以把握,就分了好几个类型,添加了很多个控件,导致代码冗余很大,程序过于复杂

评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值