本文介绍了如何使用vb6.o查找两个日期之间的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub Command1_Click()

调用dbConnect





SQL =" SELECT * FROM Expences WHERE(((''月')介于#"& DTPicker1.Value&"#And#"& DTPicker2.Value&"#))"

RS。 Open SQL,Conn,adOpenForwardOnly,adLockReadOnly

使用DataReport5.Sections(" Section1")。Controls'section1表示您在datareport中创建的部分

.Item(" Text1")。DataField = RS(" ID")。名称

.Item(" Text2")。DataField = RS(" Month")。名称

.Item(" Text3")。DataField = RS(" Expenditure")。Name

.Item(" Text4")。DataField = RS(" Purpose")。Name

.Item(" Text5")。DataField = RS(" Amount")。名称



'.Item("" Function1" ;)。DataField = MyRs(Amount)。名称



结束



设置DataReport5.DataSource = RS

DataReport5.Show



结束子





iam使用ms-access 2003数据库

month数据类型作为文本,我把'月'







但我无法在数据报告中看到结果。





plz帮帮我

Private Sub Command1_Click()
Call dbConnect


SQL = "SELECT * FROM Expences WHERE ((('Month') Between # " & DTPicker1.Value & "# And # " & DTPicker2.Value & "#))"
RS.Open SQL, Conn, adOpenForwardOnly, adLockReadOnly
With DataReport5.Sections("Section1").Controls 'section1 mean that section you create in datareport
.Item("Text1").DataField = RS("ID").Name
.Item("Text2").DataField = RS("Month").Name
.Item("Text3").DataField = RS("Expenditure").Name
.Item("Text4").DataField = RS("Purpose").Name
.Item("Text5").DataField = RS("Amount").Name

'.Item("Function1").DataField = MyRs("Amount").Name

End With

Set DataReport5.DataSource = RS
DataReport5.Show

End sub


iam using ms-access 2003 database
month datatype as text for that i put 'Month'



but i cannot see the result on data report.


plz help me

推荐答案


SELECT * FROM Expences WHERE ('Month') Between '" & Format(DTPicker1.Value, "MM") & "' And '" & Format(DTPicker2.Value, "MM") & "' 





希望这能解决你的问题。



Hope this will solve ur problem.


这篇关于如何使用vb6.o查找两个日期之间的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 22:20