Data type enforcement error

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".
 
P

Pieter Wijnen

The Format property does not enforce decimal places
to store only 2 decimals you'd have to use the round function

HTH

Pieter
 
K

kk

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?
 
P

Pieter Wijnen

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
 
K

kk

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!
 
P

Pieter Wijnen

de nada
just remember to use Round(x,2)

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

Pieter
 

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

Top