Hello Friends,

I've designed a form which uses two DTPicker Control to select data of particular range. I want to display List of students enrolled in the period selected. I've written following code for that :

VB Code:
  1. Dim dStartDate As Date
  2.     Dim dEndDate As Date
  3.     dStartDate = Format(dtpFrom.Value, "dd/MM/yyyy")
  4.     dEndDate = Format(dtpTo.Value, "dd/MM/yyyy")
  5.     With crStudList
  6.         .Connect = strConn
  7.         .SelectionFormula = "{tblStudent.RegistrationDate}>=datevalue(#" & dStartDate & "#) and {tblStudent.RegistrationDate}<=datevalue(#" & dEndDate & "#)"
  8. '        .SelectionFormula = "{tblStudent.RegistrationDate}>= DateValue (" & dtpFrom.Value & ") and {tblStudent.RegistrationDate}<= DateValue(" & dtpTo.Value & ")"
  9.         .ReportFileName = App.Path & "\reports\StudentList.rpt"
  10.         .ReportTitle = "Student List"
  11.         .WindowTitle = "Student List"
  12.         .WindowState = crptMaximized
  13.         .Destination = crptToWindow
  14.         .Action = 1
  15.     End With

where i want to display students registered between dStartDate and dEndDate. If i select start date as 01/02/2006 and end date as 28/02/2006 then its giving students registered in january also. But if i give 02/01/2006 and 28/02/2006 its giving correct result. I tried

VB Code:
  1. crStudList.SelectionFormula = "{tblStudent.RegistrationDate}>=datevalue(#" & dStartDate & "#) and {tblStudent.RegistrationDate}<=datevalue(#" & dEndDate & "#)"

but no difference and getting same report. plz help me. I tried lot but not getting solution. Any quick help will be appreciated.

thx in advance