Can a column be split in Access like it can in Excel? (text to co.

  • Thread starter What's up with that?
  • Start date
W

What's up with that?

I have a column in a table called "Duration". It's a time format, hr:mm:ss.
I need to split the column and disgard the minutes and seconds.
 
D

Douglas J. Steele

Assuming Duration is a Date field, you can use the Hour function (or
DatePart) to extract simply the hour from the existing value.

If it's a Text field, you can use the Left function.
 
W

What's up with that?

How do I specify a function in Access? Help tells me what they do, and I
don't see it from the Insert menu bar.
Is it done within the table? or a query? or?

Phil
 
D

Douglas J. Steele

If you're okay with leaving the data as it is in the table, the easiest
approach is probably to create a computed field in a query, and use the
query where you would otherwise have used the table. (You cannot use
functions in tables)

In a blank field in your query, try

DurationHours: Hour([Duration])

or

DurationHours: Left([Duration, InStr([Duration], ":") - 1)

depending, of course, if Duration is text or date.

If you want to change the table permanently, you can use an Update query.
 
Top