Solved

Restrict the length of a number

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 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