Results 1 to 3 of 3
  1. #1
    jghogue is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2015
    Posts
    1

    Base 60 formatting of numeric field

    Greetings All,



    I have a form that asks for the number of minutes it takes to perform a task. I would like for the user to enter the value with this mask: hh:mm. I want the data stored in the table as whole minutes so an entry of 1:30 would be saved as 90. Any suggestions? BTW, vba coding is no problem.

    Thanks.

    jghogue

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You could format an unbound textbox as "Short Time" and ...

    Code:
    Dim dtBase As Date
    Dim dtTime As Date
    Dim lngAnswer As Long
    
    dtBase = #12:00:00 AM#
    dtTime = Me.txtTime.Value
    
    lngAnswer = DateDiff("n", dbase, dtTime)
    MsgBox lngAnswer

  3. #3
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    You could also use:
    CDbl(Me.txtTime) * 1440

    CDbl converts the time to a long floating point number where the decimal portion is the number of seconds past midnight. You multiply that by 1440 (60 x 24) to get the number of minutes.

    Ron

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

Similar Threads

  1. Replies: 19
    Last Post: 03-29-2014, 12:48 AM
  2. Replies: 1
    Last Post: 03-09-2014, 06:30 PM
  3. Replies: 11
    Last Post: 07-05-2013, 08:00 AM
  4. numeric field in table
    By msasan1367 in forum Access
    Replies: 13
    Last Post: 04-07-2013, 10:28 AM
  5. Justify numeric text field
    By tpcervelo in forum Queries
    Replies: 2
    Last Post: 01-27-2011, 03:50 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