excel time field data

C

chris

I am importing time fields from excel (00:00:45) which is
45 seconds. When importing into access the field comes
up with (12:00:45) even after making the data being long
form.

Any thoughts
 
K

Ken Snell

In ACCESS, the default date/time format will be the short time, which means
that your 00:00:45 is treated as 12:00:45 am, or 12:00:45).

How are you importing the data into ACCESS -- TransferSpreadsheet? If so,
you won't have much control directly over the actual format that you get.

You can do one of two things:

(1)
Add a field (formatted as Long Integer) to the table and run an update query
that is similar to the following:
UPDATE TableName SET NewFieldName = [ImportedTimeField] * 24 * 60 *
60;

This will convert the imported time value into seconds and store them in the
new field. You then can delete the ImportedTimeField from the table if you
wish.

Alternatively, you can create a new table and run an append query that copy
the data to the new table, and use a calculated field similar to above
instead of the ImportedTimeField.


(2)
Import the data via VBA code by opening the EXCEL file and writing the data
cell by cell and row by row into a recordset that is based on the table that
is to receive the data. This option is overkill if you're not going to do it
regularly, repetively, and routinely. Post back if you want more info about
this.
 

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