PC Review


Reply
Thread Tools Rate Thread

Calculation/ decimal problem

 
 
=?Utf-8?B?Qm9ubmll?=
Guest
Posts: n/a
 
      28th Mar 2007
Hi- Hope you can help!


I am running a macro (Run SQL) as follows:

UPDATE tvc Set field2 = ((ScannedUnits)/BaseUnits)*100 WHERE 1=1

The problem with this statement or field is that it rounds up/down the
calculation.

If the answer is: 118.446, in the field it rounds it down to: 118.00

I have tried setting the decimal point to two or more, but it just gives me
zeros. I want the return result to be the exact calculation of: 118.446.



Hopefully I explained this OK.

Thanks if you can be of any help!

 
Reply With Quote
 
 
 
 
Douglas J. Steele
Guest
Posts: n/a
 
      28th Mar 2007
What's the data type of field2? When you set a field to Number, the default
Field Size (lower left-hand corner) is Long Integer, which cannot hold any
decimal points. You need to change the Field Size to a type that can hold
decimals: Single, Double or Decimal.

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


"Bonnie" <(E-Mail Removed)> wrote in message
news:6A444874-C791-4ABE-9D77-(E-Mail Removed)...
> Hi- Hope you can help!
>
>
> I am running a macro (Run SQL) as follows:
>
> UPDATE tvc Set field2 = ((ScannedUnits)/BaseUnits)*100 WHERE 1=1
>
> The problem with this statement or field is that it rounds up/down the
> calculation.
>
> If the answer is: 118.446, in the field it rounds it down to: 118.00
>
> I have tried setting the decimal point to two or more, but it just gives
> me
> zeros. I want the return result to be the exact calculation of: 118.446.
>
>
>
> Hopefully I explained this OK.
>
> Thanks if you can be of any help!
>



 
Reply With Quote
 
=?Utf-8?B?Qm9ubmll?=
Guest
Posts: n/a
 
      29th Mar 2007
Thanks for responding Doug...I have a follow-up question though.

Yes, my field type is Text.

In Field Size it was defaulted to 50. Are you suggesting I change it to
"Decimal?" Or my question is, what do I enter into that field other than
"50?" It appears it only allows me to enter in numbers??



"Bonnie" wrote:

> Hi- Hope you can help!
>
>
> I am running a macro (Run SQL) as follows:
>
> UPDATE tvc Set field2 = ((ScannedUnits)/BaseUnits)*100 WHERE 1=1
>
> The problem with this statement or field is that it rounds up/down the
> calculation.
>
> If the answer is: 118.446, in the field it rounds it down to: 118.00
>
> I have tried setting the decimal point to two or more, but it just gives me
> zeros. I want the return result to be the exact calculation of: 118.446.
>
>
>
> Hopefully I explained this OK.
>
> Thanks if you can be of any help!
>

 
Reply With Quote
 
Jamie Collins
Guest
Posts: n/a
 
      29th Mar 2007
On Mar 28, 11:04 pm, "Douglas J. Steele"
<NOSPAM_djsteele@NOSPAM_canada.com> wrote:
> What's the data type of field2? When you set a field to Number, the default
> Field Size (lower left-hand corner) is Long Integer, which cannot hold any decimal points.


In Access 2007, the default is DECIMAL ;-)

Jamie.

--



 
Reply With Quote
 
Douglas J. Steele
Guest
Posts: n/a
 
      30th Mar 2007
Why are you storing a numeric value (that's calculated) in a text field?

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


"Bonnie" <(E-Mail Removed)> wrote in message
news:B456ABEB-ED1C-490D-9A60-(E-Mail Removed)...
> Thanks for responding Doug...I have a follow-up question though.
>
> Yes, my field type is Text.
>
> In Field Size it was defaulted to 50. Are you suggesting I change it to
> "Decimal?" Or my question is, what do I enter into that field other
> than
> "50?" It appears it only allows me to enter in numbers??
>
>
>
> "Bonnie" wrote:
>
>> Hi- Hope you can help!
>>
>>
>> I am running a macro (Run SQL) as follows:
>>
>> UPDATE tvc Set field2 = ((ScannedUnits)/BaseUnits)*100 WHERE 1=1
>>
>> The problem with this statement or field is that it rounds up/down the
>> calculation.
>>
>> If the answer is: 118.446, in the field it rounds it down to: 118.00
>>
>> I have tried setting the decimal point to two or more, but it just gives
>> me
>> zeros. I want the return result to be the exact calculation of: 118.446.
>>
>>
>>
>> Hopefully I explained this OK.
>>
>> Thanks if you can be of any help!
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Calculation based on decimal cjborntorun Microsoft Excel Misc 3 12th May 2009 03:33 PM
decimal calculation karim Microsoft VB .NET 1 20th Oct 2008 08:43 AM
Calculation with Decimal Cmenkedi Microsoft Excel Worksheet Functions 5 3rd Jan 2008 11:07 PM
problem with decimal in calculation =?Utf-8?B?QW1hbmRh?= Microsoft Excel Misc 5 12th Jan 2006 05:25 PM
SQL SUM calculation decimal?? ed Microsoft Access Forms 2 25th Mar 2004 05:38 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:58 AM.