Dim conn As New ADODB.Connection Dim rs As New ADODB.Recordset Dim dfrom, dto As Date dfrom = DTPicker1.Value dto = DTPicker2.Value conn.Open "bwais" rs.Open "select StockNo,NameOfItem,Unit,TDate from history where TDate Between '" & dfrom & "' and '" & dto & "'", conn, 3, 3 With grid1 .ColWidth(0) = 2500 .ColWidth(1) = 2050 .ColWidth(2) = 1500 .ColWidth(3) = 3100 End With Set grid1.Recordset = rs Set rs = Nothing Set conn = Nothing
when i tried to view data between 1/1/2013 to 1/10/2013 the only data displayed was data that has a date of 1/1/2013 and 1/10/2013. Between those dates data are not displayed on the flexgrid.
then when i tried to view again data between 1/1/2013 to 1/8/2013, now all data within that month are displayed on the flexgrid.
i also tried to view data between two different months 1/1/2013 to 2/2/2013, all data save on my database are displayed on the flex grid. including dates even before 1/1/2013 are displayed.
i have tried changing the data type of TDate to Date/Time in the database but it will error to Data type mismatch in criteria expression.
i just want to view data between two different dates..
can anyone give me the correct sql statement for this?
i'm trying to upload image but this site says "Error The server returned an error during upload"..