'clear chequeprint database
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = OpenDatabase(db_dir)
Set rst = db.OpenRecordset("Chequeprint")
If rst.RecordCount <> 0 Then
Do While Not rst.EOF
Dim rst2 As DAO.Recordset
Dim sqlstr As String
date1 = Format(dtpicker1.value,"dd/mm/yyyy")
date2 = Format(dtpicker2.value, "dd/mm/yyyy")
'The date in my database is same as above
sqlstr = "Select * from Cheque where dt between #" & date1 & "# and #" & date2 & "#;"
Set rst2 = db.OpenRecordset(sqlstr, dbOpenDynaset)
If .RecordCount > 0 Then
Do While Not .EOF
For a = 0 To 6
rst(a) = rst2(a)
MsgBox "No records found!"
Hi guys, I'm having some difficulty with my coding. Basically, this form would be selecting records based on range of date selected from a table and placing them into a temp table to generate a report view. However, though everything seems correct, it doesnt pick out the correct records. It always return all the wrong date like if my date 1 = 10/08/2004 and my date 2 = 11/09/2004 it can practically select the whole database out including dates which are in the 2003 and 2002. Why is that so? is there any problem with my SQL statement? Please enlighten. Thanx a lot.