Importing and changing times

C

Chip193

I have an excel worksheet that is sent to me on a regular basis for analysis.
I do the analysis in Access. Both are from the Office 2000 product.

When the times are sent to the Excel database, they are sent as text in the
form 0123 (24 hr clock). I need to convert them to times that Access can
understand.

I can change them in Excel using the TIME command, but the command provides
different output in Access.

Any ideas?

Thanks.
 
K

Klatuu

If you can always assume the text for the time will be 4 characters, with the
left 2 digits being hour and the right 2 being minutes, this will do it:
xlTime = "0123"
MyTime = TimeSerial(Val(Left(xlTime,2)),Val(Right(xlTime,2)),0)
now, MyTime = 1:23:00 AM
 

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