I made a Data report. I write code like:
select *from table1 where date1 and date2 between dtpicker1.value and dtpicker2.value
but the data not show in report. but when I write like:
select *from table1 where date1 and date1 between dtpicker1.value and dtpicker2.value
then data show. what problem? another thing I used three date and I want all data of this three date will show in report.

any body help me please

Well the between operator is for use on one field so...

SELECT * FROM Table1 WHERE (Date1 AND Date1 BETWEEN DTP1.Value AND DTP2.Value) AND (Date2 AND Date2 BETWEEN DTP1.Value AND DTP2.Value)

As for three dates...

SELECT * FROM Table1 WHERE DATE1 = Value1 OR Date1 = Value2 OR Date1 = Value3


Good Luck

I write code for three date like:
SELECT * FROM Table1 WHERE (Date1 AND Date1 BETWEEN DTP1.Value AND DTP2.Value) AND (Date2 AND Date2 BETWEEN DTP1.Value AND DTP2.Value) AND (Date3 AND Date3 BETWEEN DTP1.Value AND DTP2.Value)

But it not work.

try something like....

SELECT * FROM Table1 WHERE (Date1 >= DTP1.Value AND Date1 <= DTP2.Value) AND (Date2 >= DTP1.Value AND Date2 <= DTP2.Value) AND (Date3 >= DTP1.Value AND Date3 <= DTP2.Value)

Which is or should be the same as the between statement and if this does not work use access's query design window to help you create the query one step at a time.

Good Luck

use
"date1 between #" & format(dtpck1.value,"mm/dd/yyyy") & "# and #" & format(dtpck2.value,"mm/dd/yyyy") & "#"

and so on

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.