Formating decimal places in an unbound field

A

Alex

Hi, I have an unvound control which contains some text as well as the
following code:
& [Score]*100/[MaxMarks] & "
How do I restrict the calculation above to 0 places of decimal. i tried
setting the control properties, but that seems to have no effect

Thanks
A
 
S

Stefan Hoffmann

hi Alex,
Hi, I have an unvound control which contains some text as well as the
following code:
& [Score]*100/[MaxMarks] & "
How do I restrict the calculation above to 0 places of decimal. i tried
setting the control properties, but that seems to have no effect
Of course, as a string can't be formatted.

Use the CInt(), Int() or Fix() function, e.g.
CInt([Score]*100/[MaxMarks]).


mfG
--> stefan <--
 
M

Marshall Barton

Alex said:
Hi, I have an unvound control which contains some text as well as the
following code:
& [Score]*100/[MaxMarks] & "
How do I restrict the calculation above to 0 places of decimal. i tried
setting the control properties, but that seems to have no effect


Use the Format function to get whatever formatting you want:

.... & Format(Score*100/MaxMarks, "#,##0") & ...
 

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