number display

  • Thread starter Thread starter ME
  • Start date Start date
M

ME

I have unbound text boxes on a form for entry of time in
HH:MM:SS format. Someone is the newsgroup helped me with
the code to convert/save the time as HH only and on the
Form_Current event I have the following code to display
the data back:

If Not IsNull(Me![RunTime]) Then
Me!Text96 = Me![RunTime] * 3600
Me!txtHr = Me![Text96] / 3600
Me!txtMin = Me![Text96] / 60 Mod 60
Me!txtSec = Me![Text96] Mod 60
End If

But I don't want the txtHr to display any decimal places
ie;1.67 in RunTime should display 1:40:00 but it's
obviously displaying 1.67:40:00 because of my code. I have
the decimal properties set to 0 and if I shrink the box it
will round off the number which I also don't want. Any
ideas? Thanks for the help.
 
Change Me!txtHr = Me![Text96] / 3600 to Me!txtHr = Me![Text96] \ 3600. Using
the \ (backslash) does Integer division and will only return the integer
part.
 
Thanks a bunch Lynn.
-----Original Message-----
Change Me!txtHr = Me![Text96] / 3600 to Me!txtHr = Me! [Text96] \ 3600. Using
the \ (backslash) does Integer division and will only return the integer
part.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I have unbound text boxes on a form for entry of time in
HH:MM:SS format. Someone is the newsgroup helped me with
the code to convert/save the time as HH only and on the
Form_Current event I have the following code to display
the data back:

If Not IsNull(Me![RunTime]) Then
Me!Text96 = Me![RunTime] * 3600
Me!txtHr = Me![Text96] / 3600
Me!txtMin = Me![Text96] / 60 Mod 60
Me!txtSec = Me![Text96] Mod 60
End If

But I don't want the txtHr to display any decimal places
ie;1.67 in RunTime should display 1:40:00 but it's
obviously displaying 1.67:40:00 because of my code. I have
the decimal properties set to 0 and if I shrink the box it
will round off the number which I also don't want. Any
ideas? Thanks for the help.


.
 
You're welcome.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


ME said:
Thanks a bunch Lynn.
-----Original Message-----
Change Me!txtHr = Me![Text96] / 3600 to Me!txtHr = Me! [Text96] \ 3600. Using
the \ (backslash) does Integer division and will only return the integer
part.

--
Lynn Trapp
MS Access MVP
www.ltcomputerdesigns.com
Access Security: www.ltcomputerdesigns.com/Security.htm


I have unbound text boxes on a form for entry of time in
HH:MM:SS format. Someone is the newsgroup helped me with
the code to convert/save the time as HH only and on the
Form_Current event I have the following code to display
the data back:

If Not IsNull(Me![RunTime]) Then
Me!Text96 = Me![RunTime] * 3600
Me!txtHr = Me![Text96] / 3600
Me!txtMin = Me![Text96] / 60 Mod 60
Me!txtSec = Me![Text96] Mod 60
End If

But I don't want the txtHr to display any decimal places
ie;1.67 in RunTime should display 1:40:00 but it's
obviously displaying 1.67:40:00 because of my code. I have
the decimal properties set to 0 and if I shrink the box it
will round off the number which I also don't want. Any
ideas? Thanks for the help.


.
 
Back
Top