Hi, I have a field in a query, as follows -
SharesToPurchase: [TotalCash] / [Forms]![frm_EnterPurchaseDetails]![txtEnterPurchasePrice]
where [TotalCash = 272.58, and [txtEnterPurchasePrice] = 6.49. Dividing [TotalCash] by [txtEnterPurchasePrice] should come to exactly 42.
This is the only case in my data set where the result works out to a whole number - the rest have fractions. They should all be whole numbers. The problem I'm having is, when I apply the INT function to the above formula, the result of the formula using the figures above is now 41, not 42?! The rest are fine. Please help!
Access 2K has a Round() function.
More to the point, non-integer arithmetic will nearly always result in a value which is very close, but not equal to, the correct integral value.
Hence, in this case, because the answer is actually an exact integer, the possibility is open for a rounding error.
If you use the Round() function instead, you will still have exactly the same arithmetic, but the problem should not manifest itself due to the nature of rounding as opposed to truncating.
4 1622
Sorry, I forgot to mention that this is Access 2000, and there is no round function. All I need to do is remove the fractional part, but not round it. Thanks.
NeoPa 32,556
Expert Mod 16PB
Access 2K has a Round() function.
More to the point, non-integer arithmetic will nearly always result in a value which is very close, but not equal to, the correct integral value.
Hence, in this case, because the answer is actually an exact integer, the possibility is open for a rounding error.
If you use the Round() function instead, you will still have exactly the same arithmetic, but the problem should not manifest itself due to the nature of rounding as opposed to truncating.
Thanks. That worked. I didn't realise there was a Round function as it wasn't listed in the functions list within the Expression Builder.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: |
last post by:
If I need to check if a certain value does exist in a field, and return
either "yes" or "not" which query would be the most effestive?
|
by: Robert Brown |
last post by:
suppose I have the following table:
CREATE TABLE (int level, color varchar, length int, width int, height
int)
It has the following rows
1, "RED", 8, 10, 12
2, NULL, NULL, NULL, 20...
|
by: Hennie de Nooijer |
last post by:
Hi, This is a diffcult issue to explain. I hope to make my problem
clear to you.
SITUATION
I'm building A SLA Query for a customer. This customer has an awkward
way to determine the SLA results...
|
by: No Spam |
last post by:
Dear Access 2000 users,
I have a crosstab query that puts together certain information
perfectly. It has a criteria that is based on a form that limits how
many columns are returned based on...
|
by: jjturon |
last post by:
Can anyone help me??
I am trying to pass a Select Query variable to a table using Dlookup
and return the value to same select query but to another field.
Ex.
SalesManID ...
|
by: Crash |
last post by:
Hi,
..NET v1.x SP1
VS 2003
SQL Server 2000 SP3
Server 2000, XP, Server 2003
I would like to programmatically execute {possibly many} SQL Server
batch scripts. Aka I have many scripts that...
|
by: veaux |
last post by:
I have a table that looks like below:
Name, Address, Favorite Pet
Bill Smith, 123 Smith St, Dogs
Bill Smith, 123 Smith St, Cats
The "Dogs" and "Cats" are actually in a lookup table, but have...
|
by: Flic |
last post by:
Hi,
I have a basic db that I access with MySQL query browser. Everything
seems fine to me but I am using this db as part of a php shopping
basket and when I try to add an item I get:
Notice:...
|
by: Karl Groves |
last post by:
I'm missing something very obvious, but it is getting late and I've
stared at it too long.
TIA for responses
I am writing a basic function (listed at the bottom of this post) that
returns...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |