Data type enforcement error

  • Thread starter Thread starter kk
  • Start date Start date
K

kk

Hello everybody!
I have an access database (obviously!) and I have the following
problem: data doesn't seem to be stored in the tables according to the
datatype that I have declared in the table's data type definition.

Let's say I have a table A with a field B that has the following
properties:

Data Type: Number
Field size: Single
Format: Euro
Decimal places: 2

If I store the value "48.35" for example, and I try later to edit that
record, the value that appears to the screen is "48.35 E" (where E is
the Euro sign), but when I click to the textbox to edit that value,
the textbox displays the value "48,3499984741211".
 
The Format property does not enforce decimal places
to store only 2 decimals you'd have to use the round function

HTH

Pieter
 
Thanks Pieter for your answer.
I do not understand at which point do you suggest that I should use
the Round function. At the OnGotFocus event of the textbox that
contains the value, or at the BeforeUpdate event of the form?
 
Depends on when you want the data updated (where it comes from)
if it is calculated in the form, the before_update springs to mind, else I'd
Use the Form_Current I think.

Pieter
 
I need to be able to sum up these values... so perhaps I should also
use Sum(Round(field)).

Thank you very much for your help!
 
de nada
just remember to use Round(x,2)

btw
if it's money use round(sum(x)) instead <g>

Pieter
 
Back
Top