Solved

Restrict the length of a number

Posted on 2011-09-29
4
293 Views
Last Modified: 2012-05-12
Experts,
In my table I have to restrict the size of  numeric and text feilds to be specific length. I wanted to define this in the table. For example, field OriginID's numeric length mus be 10 or CompanyName's length must be 16.
0
Comment
Question by:Frank Freese
4 Comments
 
LVL 10

Expert Comment

by:ukerandi
ID: 36818335
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 36818507
fh_freese,

For text, it's easy: put your table in design view, and you will see in the column definitions that you can specify the text length.

For numbers it's harder.  For example, the Long data type can accept SOME 10-digit numbers, but only up to about 2.1 billion.  You may be better off using a text field for your "numeric" OriginID if you really need 10 digits.

(You could use the Double data type, which allows for larger numbers and stores up to 15 significant digits, but depending on how you are using it, that can introduce new problems...)

Patrick
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 250 total points
ID: 36840692
Numbers really don have a "Length"

If you define this field as Text in the table, and only allow numbers to be entered, then yes, what you are asking is possible.

Set the FieldSize property of this "numbers only" Text field to: 10
Set the InputMask property of this "numbers only" Text field to: 9999999999

JeffCoachman
0
 

Author Closing Comment

by:Frank Freese
ID: 36893511
thank you
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now