Math Calculations in Unbound Form
Results 1 to 3 of 3

Thread: Math Calculations in Unbound Form
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Aug 2007
    Location
    NJ, USA
    Posts
    71
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Math Calculations in Unbound Form

    I have a form that has a simple calculation that needs to be done and I was almost certain I was able to do this in an unbound form but I'm not having any luck

    I have two values in unbound text boxes that are time. For example:

    Text01 "txtTalkTime" = 00:43:13 (The user should enter the amount of time spent talking)
    Text02 "txtReadyTime" = 01:35:24 (The user should enter the amount of time spent ready)
    Text03 "txtCoverageProvided" = Text01 + Text02 (This should display 02:18:37, adding both the above fields)
    Text04 "txtCoverageRequirement" = 04:00:00 (The user should enter the amount of time required)
    Text05 "txtCoverageRemaining" = Text04 - Text03 (This should display 01:41:23, subtracting the provide amount of coverage from the requirement)

    I didn't think that this was overly complicated, I have this completed in Excel easily but for some odd reason, I'm having quite the challenge of getting this in Access. I think it may be an issue of formatting and the expression used.

    Anyone have any advice?

  2. #2
    Board Regular apr pillai's Avatar
    Join Date
    Aug 2008
    Location
    Kerala, India
    Posts
    235
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Math Calculations in Unbound Form

    Format all Text Boxes as Long Time and see that the time value is entered exactly as shown (00:43:13) in all the data entry text boxes. this will be converted internally as a decimal number. The Long Time formatting shows it in hr:min:sec format.

    More details you can find here: Date and Time Values | LEARN MS-ACCESS TIPS AND TRICKS
    https://msaccesstips.com(Learn MS-Access Tips and Tricks)
    Learn Advanced MS-Access Programming with sample VBA Code.

  3. #3
    Board Regular
    Join Date
    Aug 2007
    Location
    NJ, USA
    Posts
    71
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Math Calculations in Unbound Form

    I was able to get working. I found the problem. txtCoverageRequirement is supposed to have a default value of 04:00:00 but I entered this wrong. Access did not like the colons however, I found out that with date/time, it needs to be entered as =#4:00:00 AM#. With that update, everything is working smoothly.

    My only gripe is my last text box, txtCoverageRemaining, still has the AM/PM when it's clicked into. All of these fields are formatted as hh:nn:ss and when clicked into, do not display the AM/PM. I'm not sure why this one text box displays it when clicked into.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •