In my access file I write code in query

SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS TotalAmount
FROM AccountInfo
WHERE (((AccountInfo.Date)>=#1/1/2009# And (AccountInfo.Date)<=#12/31/2009#))
GROUP BY AccountInfo.incategory;

It show the total amount between 01-01-09 to 31-12-09 and it show in report. but in vb6 I want I select this two date and the total amount will show in report. what I need to do?

SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS TotalAmount
FROM AccountInfo
WHERE (((AccountInfo.Date)=#1/1/2009# OR (AccountInfo.Date)=#12/31/2009#))
GROUP BY AccountInfo.incategory;

Good Luck

I write in data environment:

SELECT AccountInfo.incategory, Sum(AccountInfo.InAmount) AS SumOfInAmount
FROM AccountInfo
where Date and Date between DTFr.value and DTTo.vlaue
GROUP BY AccountInfo.incategory;

DTFr and DTTo is dtpicker. and I write code in a button for show the report is

Load DataEnvironment1
    With DataEnvironment1
    If .Command3.State <> 0 Then .Command3.Close
     .Command3 Format(DTFr.Value, "dd/mm/yyyy"), Format(DTTo.Value, "dd/mm/yyyy")
     End With
datareport1.Show

but a error msg show:
"compile error:
argument not optional"
and then select this word

If .Command3.State <> 0 Then .Command3.Close

now what I need to do?

Seperate Q, but try value (or is this .NET?)

However, a command buttons value is only true when it is depressed (or you are inside the command buttons event).

Good Luck

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.