C
chanu
i have a table with two date fields and i opened a dao recordset (based on a
query) on it .Now i want to search whether a particular date group falls
between these dates and the rate for that period.Dates in UK style.
FromDate ToDate Rate
01/01/2009 31/03/2009 7570
01/05/2009 30/11/2009 7770
01/12/2009 31/12/2009 7970
//variables declared here
//SQL is defined here to limit it the recordset
Set rst = currentdb.OpenRecordset(strSQL, dbOpenDynaset)
MyFromDAte = 01/06/2009
MyToDate = 31/10/2009
rst.Findfirst "[FromDate] <= #" & MyFromDate & "# And [ToDate] >= #" &
MyToDate & "#"
debug.print rst!RAte
Instead of returning the second row, the findfirst property is returning the
first row (i.e.7570) only though 31/10/2009 is greater than 31/03/2009
If i change it to 'rst.FindLast',it is returning it is returning the last
row(i.e.7970) which is also wrong.Why is this happening so? though my code is
correct. Please help me
query) on it .Now i want to search whether a particular date group falls
between these dates and the rate for that period.Dates in UK style.
FromDate ToDate Rate
01/01/2009 31/03/2009 7570
01/05/2009 30/11/2009 7770
01/12/2009 31/12/2009 7970
//variables declared here
//SQL is defined here to limit it the recordset
Set rst = currentdb.OpenRecordset(strSQL, dbOpenDynaset)
MyFromDAte = 01/06/2009
MyToDate = 31/10/2009
rst.Findfirst "[FromDate] <= #" & MyFromDate & "# And [ToDate] >= #" &
MyToDate & "#"
debug.print rst!RAte
Instead of returning the second row, the findfirst property is returning the
first row (i.e.7570) only though 31/10/2009 is greater than 31/03/2009
If i change it to 'rst.FindLast',it is returning it is returning the last
row(i.e.7970) which is also wrong.Why is this happening so? though my code is
correct. Please help me