Hi guys
The following code doesn't count the distinct days right. Can anyone please figure out the problem.
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0; " & _ "Data Source=J:\log.mdb;" strsql = "select distinct count(Date1) as [Total days],sum(Chequeamt) as [Total Amount] from tblmain where Date1>=# " & Format(ws.Cells(5, 3).Value, "mm/dd/yyyy") & " # and Date2 <=# " & Format(ws.Cells(6, 3).Value, "mm/dd/yyyy") & " #;" rs.Open strsql, cn ws.Cells(13, "C").Value = rs.fields(1).Value ws.Cells(13, "D").Value = rs.fields(0).Value
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks