Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem exporting query report to Excel - Dates

Status
Not open for further replies.

nimrod44

Programmer
Sep 17, 2001
7
0
0
US
I'm using Access 97 and have created a query which all works fine. The problem is when I try to Export/Saveas to an excel spreadsheet (Excel2000). One of the columns in the report is a date field. When the report is exported to Excel, some of the records dates are formated as 3/8/2002 12:00PM, but I have the date in Access report formated to just show date 3/8/2002. The records that show both date and time seem to be random with no similarities. All the records that show a Date and Time show time as 12:00PM, and I know for a fact that not all the date entries were done at 12:00PM.
Has anybody else had something similar to this happen?? I'd appreciate any help
 
I haven't had this happen but here is an idea. Use a query to export the data. I've found all sorts of other flaky stuff (cut off fields, etc) exporting from a report. Right-click on the field in the query grid and set the properties to short date. Also, you can launch Excel directly. I did this in Access 2000.

You can export directly from the query to Excel.

'E X P O R T TO E X C E L
DoCmd.TransferSpreadsheet acExport, 8, _
"qryYourquery", pathFileName, True

' L A U N C H E X C E L
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open Me.FileName ' Opens the Excel

Mary B.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top