Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 207471 - Last Review: June 28, 2004 - Revision: 2.0
ACC2000: You Receive No Warning When a Number Is Too Large for a Single Data Type
This article was previously published under Q207471
Novice: Requires knowledge of the user interface on single-user computers.
This article applies only to a Microsoft Access database (.mdb).
If you type a value into a field whose data type is Single, and that value
is greater than what the Single data type allows, you do not receive a
warning message. Instead, Microsoft Access automatically replaces the value that you typed with the largest possible value allowed by the data type.
This behavior is caused by a rounding error that can occur when a decimal
fraction does not have an exact binary equivalent.
For additional information about rounding errors, click the article number below
to view the article in the Microsoft Knowledge Base:
210423Â
(http://kbalertz.com/Feedback.aspx?kbNumber=210423/EN-US/
)
ACC2000: Rounding Errors When You Use Floating-Point Numbers
Create a validation rule if you want a warning to appear when you have
typed a number that is too large or too small for the data type of the
field.
Example of a Validation Rule
- Follow steps 1 and 2 in the "Steps to Reproduce Behavior" section later in this article.
- After setting the format to General Number, set the following properties for the TestSingle field:
Validation rule: Between 3.402823E+38 and -3.402823E+38
Validation text: You have entered a number that is larger than the Field Size setting permits.
The range of a single-precision floating-point number is from -3.402823E38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E38 for positive values.
Steps to Reproduce Behavior
- Start Microsoft Access, and then open any database.
- Create the following table, and name it tblTestType:
Table: tblTestType
----------------------
Field Name: TestSingle
Data Type: Number
Field Size: Single
Format: General Number
- On the File menu, click Save. In the Save As dialog box, type tblTestType. When you are prompted to create a primary key, click No.
- On the View menu, click Datasheet.
- On the Tools menu, click Options, and then click the Keyboard tab. Under Move After Enter, click Don't Move, and then click OK.
- Type the following number in the first record:
3.4028235E+38
Press ENTER. Note that you receive no message that the number is too
large for this field; however, the "5" is removed without prompting, and the number is changed to the largest number appropriate for the Single data
type. This behavior also occurs if you type the following number:
-3.4028235E+38
However, when you type the following number
3.4028236E+38
you receive the following error message:
The value you entered isn't valid for this field.
For example, you may have entered text in a numeric field or a number that is larger than the FieldSize setting permits.
For more information about the single data type, click
Microsoft Visual Basic Help on the
Help menu, type
single data type in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
For more information about validation rules, click
Microsoft Access Help on the
Help menu, type
validate or restrict data entry in tables in the Office Assistant or the Answer Wizard, and then click
Search to view the topic.
APPLIES TO
- Microsoft Access 2000 Standard Edition
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate