Problem with Dates in SQL statement
I have a button on a form, which has the following code behind it:
If Not IsNull(txtStartDate) Then
If Not strSQLFilter = "" Then
strSQLFilter = strSQLFilter & " AND tblShipments.BLDate Between #" & cboStartDate & "# AND #" & cboFinishDate & "#"
Else
strSQLFilter = strSQLFilter & " tblShipments.BLDate Between #" & cboStartDate & "# AND #" & cboFinishDate & "#"
End If
End If
Currently this sql only retrieves dates between the start and finish dates, but not including them.
I need the sql to include the start and finish dates. I've tried the following with no success:
If Not IsNull(cboStartDate) Then
If Not strSQLFilter = "" Then
strSQLFilter = strSQLFilter & " AND tblShipments.BLDate >= #" & cboStartDate & "# AND tblShipments.BLDate <= #" & cboFinishDate & "#"
Else
strSQLFilter = strSQLFilter & " tblShipments.BLDate >= #" & cboStartDate & "# AND tblShipments.BLDate <= #" & cboFinishDate & "#"
End If
End If
It still doesn't include start and finish dates.
Can anyone help me with this?
Thanks,
BJS
I have a button on a form, which has the following code behind it:
If Not IsNull(txtStartDate) Then
If Not strSQLFilter = "" Then
strSQLFilter = strSQLFilter & " AND tblShipments.BLDate Between #" & cboStartDate & "# AND #" & cboFinishDate & "#"
Else
strSQLFilter = strSQLFilter & " tblShipments.BLDate Between #" & cboStartDate & "# AND #" & cboFinishDate & "#"
End If
End If
Currently this sql only retrieves dates between the start and finish dates, but not including them.
I need the sql to include the start and finish dates. I've tried the following with no success:
If Not IsNull(cboStartDate) Then
If Not strSQLFilter = "" Then
strSQLFilter = strSQLFilter & " AND tblShipments.BLDate >= #" & cboStartDate & "# AND tblShipments.BLDate <= #" & cboFinishDate & "#"
Else
strSQLFilter = strSQLFilter & " tblShipments.BLDate >= #" & cboStartDate & "# AND tblShipments.BLDate <= #" & cboFinishDate & "#"
End If
End If
It still doesn't include start and finish dates.
Can anyone help me with this?
Thanks,
BJS