Solved

Restrict the length of a number

Posted on 2011-09-29
4
324 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

829 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