J
Jeff Beveridge
I have the results of a query that I am just trying to export into
Excel. However when you export from Access it INSISTS on adding "time
information" to a "date/time" field even when you have the field set
as "short date" at the table level. So I tried using the "Format"
function by changing the field in the query grid to: myfield:
format([field],"mm/dd/yyyy") .
Now when I export the query it DOES remove the "time" information from
the field like its suppose to. However now the results of the query
are WRONG! I should mention that the two date fields in my query have
criteria in them. The criteria is basically ">=#1/1/2009# and
<=#12/31/2009# " in one field and the same in the other date field in
the query grid but one line down (making it an "OR" statement). So the
SQL in the WHERE clause looks like this:
(Format([StartDate],"mm/dd/yyyy")>=#1/1/2009# And
Format([StartDate],"mm/dd/yyyy")<=#12/31/2009#)) OR
(Format([EndDate],"mm/dd/yyyy")>=#1/1/2009# And Format([EndDate],"mm/
dd/yyyy")<=#12/31/2009#)
As I said, this seems to screw up the results of the query by
returning records outside of this date range in the results. The
results are correct if I remove the format function but then it will
export the two date fields with time information that Excel doesn't
know what to do with.
Anyone have any ideas on why this is happening or how to fix it?
Thanks.
Excel. However when you export from Access it INSISTS on adding "time
information" to a "date/time" field even when you have the field set
as "short date" at the table level. So I tried using the "Format"
function by changing the field in the query grid to: myfield:
format([field],"mm/dd/yyyy") .
Now when I export the query it DOES remove the "time" information from
the field like its suppose to. However now the results of the query
are WRONG! I should mention that the two date fields in my query have
criteria in them. The criteria is basically ">=#1/1/2009# and
<=#12/31/2009# " in one field and the same in the other date field in
the query grid but one line down (making it an "OR" statement). So the
SQL in the WHERE clause looks like this:
(Format([StartDate],"mm/dd/yyyy")>=#1/1/2009# And
Format([StartDate],"mm/dd/yyyy")<=#12/31/2009#)) OR
(Format([EndDate],"mm/dd/yyyy")>=#1/1/2009# And Format([EndDate],"mm/
dd/yyyy")<=#12/31/2009#)
As I said, this seems to screw up the results of the query by
returning records outside of this date range in the results. The
results are correct if I remove the format function but then it will
export the two date fields with time information that Excel doesn't
know what to do with.
Anyone have any ideas on why this is happening or how to fix it?
Thanks.