Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

error while searching

$
0
0
In my project i am trying to search data between two dates by DTPicker
my codes are
Dim sSQL As String
sSQL = "select * from ExpCM Where Format(Dat, 'dd-mm-yyyy') Between '" & Format(DTPicker1.Value, "dd-mm-yyyy") & "' And '" & Format(DTPicker2.Value, "dd-mm-yyyy") & "'"
Debug.Print sSQL
CMStock.Adodc1.RecordSource = sSQL

Although its working, it is giving vague results like in my database i ve data with the following dates in the following format
25-09-2012
25-09-2012
30-09-2012
25-10-2012
25-10-2012
28-10-2012
but when i am searching between dates like 25-10-2012 to 29-10-2012 am getting three results(25-10-2012,25-10-2012,28-10-2012)
but when i am searching between dates like 24-10-2012 to 29-10-2012 am getting 5 results
25-09-2012
25-09-2012
25-10-2012
25-10-2012
28-10-2012
how is this possible. please help. its urgent

Viewing all articles
Browse latest Browse all 21842

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>