本窗体思路,   站在巨人的肩膀上。

 

 

 Dim txtsql As String
    Dim Msgtext As String
    Dim mrc As ADODB.Recordset
    
    
    
    '设置起始日期不得大于终止日期   起始 begindate   终止 enddate
         If begindate.Value >= enddate.Value Then
           MsgBox "起始日期不得大于终止日期,请您重新输入!", vbOKOnly + vbExclamation, "提示"
          
           Exit Sub
        End If
    
    
    
    '查询选定范围里的数据
    txtsql = "select * from CancelCard_info where date > '" & begindate.Value & "' and date < '" & enddate.Value & "'"
    Set mrc = ExecuteSQL(txtsql, Msgtext)
    
    If mrc.EOF Then '无数据时提示
        MsgBox "该时间段无数据", vbOKOnly, "温馨提示:"
        Exit Sub
    End If
 
 
    With MSHFlexGrid1
        .Rows = 1
        .CellAlignment = 4
        .TextMatrix(0, 0) = "卡号"
        .TextMatrix(0, 1) = "退还日期"
        .TextMatrix(0, 2) = "退还时间"
        .TextMatrix(0, 3) = "退还金额"
        .TextMatrix(0, 4) = "充值教师"
        .TextMatrix(0, 5) = "结账状态"
           
        Do While Not mrc.EOF
            .Rows = .Rows + 1
            .CellAlignment = 4
            .TextMatrix(.Rows - 1, 0) = mrc.Fields(1)
            .TextMatrix(.Rows - 1, 1) = mrc.Fields(3)
            .TextMatrix(.Rows - 1, 2) = mrc.Fields(4)
            .TextMatrix(.Rows - 1, 3) = mrc.Fields(2)
            .TextMatrix(.Rows - 1, 4) = mrc.Fields(5)
            .TextMatrix(.Rows - 1, 5) = mrc.Fields(7)
            mrc.MoveNext
        Loop
     End With
     mrc.Close

 

posted on 2019-07-28 15:15  Tzk-  阅读(40)  评论(0)    收藏  举报