在机房中有三个窗体(收取金额查询、金额返还信息查询、周结账单)用到的是指定时间段数据查询,首先就是从...到...,也就是起始日期到终止日期。
“笑话”看来还是避免不了的,自己添加了控件DTPicker,又添加了ComboBox控件,这次出现的问题就是多此一举了,其实自己被学生当中的“添加学籍信息”出生日期与入学日期搞混了,“添加学籍信息”当中用到了MonthView控件与TextBox控件。当我们运行的时候点击 TextBox 控件,里面的日历自然就出现了。而自己这次点击ComboBox 控件,点的自己的手都麻了,也没看到蹦出个日历来,不过它还是逃不过我的眼睛滴,仔细一看,其实只需一个DTPicker控件就可以了,因为它自身带有下拉按钮的。而MonthView控件没有带有下拉按钮的。
1.”笑话”展示
2.工程 —— 控件
3.点击DTPicker控件 —— 在窗体中找适当位置画出来
4.这才不是笑话呢
5.编写指定时间段数据查询代码
<span style="font-family:FangSong_GB2312;font-size:24px;"><strong>Private Sub Command1_Click()
Dim txtSQL As String
Dim Msgtext As String
Dim mrc As ADODB.Recordset
Dim startdate As Data
Dim enddate As Data
startdate = DTPicker1.Value
enddate = DTPicker2.Value
txtSQL = "select * from Recharge_Info where date>= '" & startdate & "and date <='" & enddate & "'"
Set mrc = ExecuteSQL(txtSQL, Msgtext)
'比较俩个日期的大小
If DateDiff("d", CDate(startdate), CDate(enddate)) < 0 Then
MsgBox "起始日期不能小于终止日期!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
If mrc.EOF Then
MsgBox "没有数据!", vbOKOnly + vbExclamation, "警告"
Exit Sub
End If
With myflexgrid
.Rows = 1 '总行数为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
.CellAlignment = 4
.Rows = .Rows + 1
.TextMatrix(.Rows - 1, 0) = Trim(mrc.Fields(2))
.TextMatrix(.Rows - 1, 1) = Trim(mrc.Fields(3))
.TextMatrix(.Rows - 1, 2) = Trim(mrc.Fields(4))
.TextMatrix(.Rows - 1, 3) = Trim(mrc.Fields(5))
.TextMatrix(.Rows - 1, 4) = Trim(UserName)
If IsNull(mrc.Fields(7)) = False Then
.TextMatrix(.Rows - 1, 5) = Trim(mrc.Fields(7))
Else
.TextMatrix(.Rows - 1, 5) = ""
End If
mrc.MoveNext
Loop
End With
mrc.Close
End Sub</strong></span>
2.方向比速度重要,智慧比吃苦重要,学习比学历重要,机遇比关系重要,要什么比做什么重要!