Results 1 to 10 of 10
  1. #1
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14

    Round the time to Integer values

    HI All,

    I would like to Round the time what I have bellow to integer Values (10 min peridos ) for example

    15:43:14 -> 15:40:00.



    May I pefrom this by creating Query or Table is enough?

    Thank a lot

  2. #2
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Allen Browne has a UDF that can be found here

    http://allenbrowne.com/round.html#RoundTime

    Alan

  3. #3
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14
    HI

    Let me explain a little bit more advance this issue.

    I would like to create a query which compares the time (hh:mm:ss, but seconds always must be "0" and minutes roundes to 10 min periods per hour so eg. 12:10:00) between two tables.

    At one of both tables has integer 15:00:00 of time, but scond table has 15:04:16- so before that the time must be rouned

    I'm created a query and saw an error #FUNC! in Data sheet overview.

    Do you know how Can I perform that to achieve the data according to time from neighberhood table (table with not integer time )?
    Last edited by krkow; 06-12-2011 at 11:57 AM.

  4. #4
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14
    this same what above.

    Thanks a lot for advance!
    Last edited by krkow; 06-12-2011 at 12:01 PM.

  5. #5
    alansidman's Avatar
    alansidman is offline Indifferent
    Windows 7 32bit Access 2007
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,536
    Did you try Allen Brown's solution?

    Alan

  6. #6
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14
    Yes,

    I have tried to used Allan Brown's solution, but I need more advice regardiing this issue:

    I have the date and time (hh:mm:ss) and I would like to get in my query integer values of minutes . It means eg 15:43:14 then I would like to get 15:40:00 in query or table.

    So, Does anyone know how to do this?

    I have tried by using =round() in builder functions of my query, but it doesn'r work.

    Thanks

    Krystian
    Last edited by krkow; 06-13-2011 at 01:30 PM.

  7. #7
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I have tried by using =round() in builder functions of my query, but it doesn'r work.

    Thanks

    Krystian
    A simpler formula (than Allen Browne's) for your query is:

    Code:
    Round(FieldName * 144, 0) / 144
    Change "FieldName" to the name of your time field

  8. #8
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14
    HI,

    Thanks for the formula to my query. After applied below function :

    Round(FieldName * 144, 0) / 144

    I got the result as a Number.

    2011-05-10 09:05:27 -> 40673,3819444444.

    Do you know how can I change the format for this. I have tried format settigns of my query, but I don't see the "date/time" option?
    Last edited by krkow; 06-14-2011 at 11:22 AM.

  9. #9
    ssanfu is offline Master of Nothing
    Windows 2K Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    I got the result as a Number.

    2011-05-10 09:05:27 -> 40673,3819444444.

    Do you know how can I change the format for this. I have tried format settigns of my query, but I don't see the "date/time" option?
    I wouldn't worry about it in a query, since you can set the format when it is bound to a control on a form. But, there are a couple of ways to set the format for a column.
    In a column, you can use the format function:

    Code:
     TimeRounded:Format([FieldName],"hh:nn:ss")
    Change "FieldName" to your field name.

    Another way is, in design view, right click in the column and select properties. In the format row, enter hh:nn:ss .



  10. #10
    krkow is offline Novice
    Windows Vista Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    14
    HI

    I have set the format according with yours proposal. It means right click on collumn and following to propeties and put "hh:nn:ss" for Format field.

    As I result I succeed the 10 min intervals of required time.

    Thanks a lot for support!

    krkow

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Help! - Going round in Circles
    By Sleepymum in forum Database Design
    Replies: 11
    Last Post: 02-01-2011, 09:15 AM
  2. Round up time half an hour
    By JBM18 in forum Queries
    Replies: 2
    Last Post: 12-09-2010, 11:56 AM
  3. Adding column as INTEGER makes it a long integer?
    By luckycharms in forum Programming
    Replies: 2
    Last Post: 10-20-2010, 02:47 PM
  4. Round Up/Down 4 Decimals to 2
    By newbie in forum Access
    Replies: 6
    Last Post: 10-18-2010, 02:58 PM
  5. Replies: 1
    Last Post: 06-09-2006, 05:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums