A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

number display



 
 
Thread Tools Display Modes
  #1  
Old May 26th, 2004, 05:40 PM
ME
external usenet poster
 
Posts: n/a
Default number display

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.
  #2  
Old May 26th, 2004, 06:28 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default number display

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


"ME" wrote in message
...
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.



  #3  
Old May 26th, 2004, 07:27 PM
ME
external usenet poster
 
Posts: n/a
Default number display

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


"ME" wrote in

message
...
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.



.

  #4  
Old May 26th, 2004, 08:18 PM
Lynn Trapp
external usenet poster
 
Posts: n/a
Default number display

You're welcome.

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


"ME" wrote in message
...
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


"ME" wrote in

message
...
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.



.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:35 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.