Access 2007 search between two dates

Nessie

Member
Joined
Oct 14, 2011
Messages
20
Programming Experience
1-3
Hi All (again)
Trying to do a search between two dates to populate a datagrid.

The SQL I have that runs and works on Access 2007 is:

SELECT * FROM Tracker WHERE (((TrioleOpenDate)>=#10/01/2011#)AND((TrioleOpenDate)<=#10/16/2011#))

The VB code I am trying to create is so far:

sql = "SELECT * FROM Tracker WHERE (((TrioleOpenDate) >= '" & SchDateFrom.Value.Date & "' ) AND ((TrioleOpenDate) <= '" & SchDateTo.Value.Date & "'))"

Which returns

SELECT * FROM Tracker WHERE (((TrioleOpenDate) >= '01/10/2011' ) AND ((TrioleOpenDate) <= '18/10/2011'))

I am close but just can't seem to get where I want to go...

Any help would be fantastic and greatly appreciated...
 
I would use the Format function to get the dates into the proper format.

VB.NET:
Format(SchDateFrom.Value.Date, "MM/dd/yyyy")

I am not quite sure what your problem is exactly.
 

Latest posts

Back
Top