1 Divide By 2

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

I have a field called Quantity...

If Quantity =1 and I divide by 2 I get 0
How do I get it to eual .5

Thanks
DS
 
KARL said:
Check your datatype, format, and other display.

:
Its Long Integer, I changed it to Decimal. Still Doesn't Work, What
should it be?
Thanks
DS
 
DS said:
Its Long Integer, I changed it to Decimal. Still Doesn't Work, What
should it be?
Thanks
DS
Ok That worked I changed it to Single. But I need it to Display .5 not
0.5 Thanks
DS
 
DS said:
Its Long Integer, I changed it to Decimal. Still Doesn't Work, What
should it be?
Thanks
DS


Long Integer is not capable of storing fractional values (integer only).
Decimal is. Now you'll need to look at the other elements that Karl
suggested you examine.
 
DS said:
Ok That worked I changed it to Single. But I need it to Display .5 not
0.5 Thanks
DS
Got it almost. I have this 1. 0r this .5, Is there any way to set the
format so that only if the number is less than 1 the decimal shows,
otherwise it would be just 1 not 1.
Thanks DS
 
Not using the Format property, nor the Format function.

If it's essential, you could write your own function along the lines of:

Function FormatNumber(ValueToFormat As Single) As String

Dim strFormatted As String

strFormatted = ValueToFormat
If ValueToFormat >= 1 Then
strFormatted = Replace(strFormatted, ".", "")
End If

FormatNumber = strFormatted

End Function
 

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

Back
Top