time format when exporting

D

dimwit

I am exporting an access data to an excel spreadsheet using vba code. The
problem is the format for my time when exported to excel is different. How
can i change the cell format for excel using the codes in access. I use the
code below to export. Thanks!

DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel3,
"tblTimeTable", "" & strInputFileName & "", False
 
K

Ken Snell [MVP]

Don't export the table directly. Instead, create a query that is based on
the table. In the query, instead of using the real "time" field, use a
calculated field where you use the Format function to expressly format the
output. For example,

MyTimeField: Format([TimeField], "hh:nn")

Save the query. Then export the query instead of the table.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top