Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / New Users / December 2005

Tip: Looking for answers? Try searching our database.

1 Divide By 2

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DS - 28 Dec 2005 21:32 GMT
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 DEWEY - 28 Dec 2005 21:46 GMT
Check your datatype, format, and other display.

> I have a field called Quantity...
>
[quoted text clipped - 3 lines]
> Thanks
> DS
DS - 28 Dec 2005 21:57 GMT
> Check your datatype, format, and other display.
>
[quoted text clipped - 5 lines]
>>Thanks
>>DS

Its Long Integer, I changed it to Decimal. Still Doesn't Work,  What
should it be?
Thanks
DS
DS - 28 Dec 2005 22:09 GMT
>> Check your datatype, format, and other display.
>>
[quoted text clipped - 10 lines]
> Thanks
> DS
Ok That worked I changed it to Single.  But I need it to Display .5 not
0.5 Thanks
DS
DS - 28 Dec 2005 22:16 GMT
>>> Check your datatype, format, and other display.
>>>
[quoted text clipped - 14 lines]
> 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
Douglas J. Steele - 29 Dec 2005 13:18 GMT
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

Signature

Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

> 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.
Randy Harris - 28 Dec 2005 22:12 GMT
> > Check your datatype, format, and other display.
> >
[quoted text clipped - 10 lines]
> 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.

Signature

Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.