?
********
In a query
SELECT * FROM RONCHECK_access
WHERE (((RONCHECK_access.DATE) Between [enter startdate] And [enter
enddate]));
this select statement works and retrieves data between a keyboard entered
date range.
If I try to do the same thing in a combo box, with start and end date data
coming from two calendar objects, on a form with this code for a mousedown
event
Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As
Single, Y As Single)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM RONCHECK_access " _
& "WHERE (((RONCHECK_access.DATE) Between " _
& "#" & start_date_cal.Value & "# And #" & end_date_cal.Value & "#));"
Set rs = db.OpenRecordset(strSQL)
End Sub
the data still comes across but it is not restricted by the date range. I
know that DATE is a restricted word, but I don't think that is the problem
here. Using DATE in the query select produced the correct results. In debug
mode the start and end date values are correct. Am I using # or anything else
in this select statement incorrectly? There are no syntax or execution errors.
Thanks.
SELECT * FROM RONCHECK_access
WHERE (((RONCHECK_access.DATE) Between [enter startdate] And [enter
enddate]));
this select statement works and retrieves data between a keyboard entered
date range.
If I try to do the same thing in a combo box, with start and end date data
coming from two calendar objects, on a form with this code for a mousedown
event
Private Sub db_betw_dates_obj_MouseDown(Button As Integer, Shift As Integer,
X As
Single, Y As Single)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM RONCHECK_access " _
& "WHERE (((RONCHECK_access.DATE) Between " _
& "#" & start_date_cal.Value & "# And #" & end_date_cal.Value & "#));"
Set rs = db.OpenRecordset(strSQL)
End Sub
the data still comes across but it is not restricted by the date range. I
know that DATE is a restricted word, but I don't think that is the problem
here. Using DATE in the query select produced the correct results. In debug
mode the start and end date values are correct. Am I using # or anything else
in this select statement incorrectly? There are no syntax or execution errors.
Thanks.