text box format

G

Guest

I have a text box that's not returning as expected. Here's its Control Source:
=(Sum([ProjectHours]*60)+Sum([ProjectMinutes]))/60 & " Hrs"

Its format is "Fixed" to 2 decimal places however it returns more than 2
decimal places. I suspect that's because I've the text "Hrs" may be clashing
with the numeric value...?

Can this be fixed?

Thanks!
 
C

Carl Rapson

JohnLute said:
I have a text box that's not returning as expected. Here's its Control
Source:
=(Sum([ProjectHours]*60)+Sum([ProjectMinutes]))/60 & " Hrs"

Its format is "Fixed" to 2 decimal places however it returns more than 2
decimal places. I suspect that's because I've the text "Hrs" may be
clashing
with the numeric value...?

Can this be fixed?

Thanks!

You may be right about the reason, because the " Hrs" string is being
concatenated onto your number before the textbox format is applied. Try
using the Format method around your Sum clause to format the number prior to
concatenating " Hrs":

=Format((Sum([ProjectHours]*60)+Sum([ProjectMinutes]))/60, "0.00") & " Hrs"

Carl Rapson
 
G

Guest

Thanks, Carl! Nothing like an "easy" one for a change!
--
www.Marzetti.com


Carl Rapson said:
JohnLute said:
I have a text box that's not returning as expected. Here's its Control
Source:
=(Sum([ProjectHours]*60)+Sum([ProjectMinutes]))/60 & " Hrs"

Its format is "Fixed" to 2 decimal places however it returns more than 2
decimal places. I suspect that's because I've the text "Hrs" may be
clashing
with the numeric value...?

Can this be fixed?

Thanks!

You may be right about the reason, because the " Hrs" string is being
concatenated onto your number before the textbox format is applied. Try
using the Format method around your Sum clause to format the number prior to
concatenating " Hrs":

=Format((Sum([ProjectHours]*60)+Sum([ProjectMinutes]))/60, "0.00") & " Hrs"

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top