Added quote around dates in sql statements
now correctly opening file