sql select- Help, thanks!

?

********

In a sql select statement, the data is not being restriced to a date range
even though the start & end date values are verified to be correct. The data
is displayed without being restricted by the where clause. Date is a field in
the table. What am I doing wrong. Thanks.

There are no errors in the following code:

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
Set db = CurrentDb
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
 
T

TomU

DATE is a reserved word in VBA. Bracketing it as you do may nullify that but
I'm not sure of that. Maybe you should rename it in your table.

TomU
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top