• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 537
  • Last Modified:

integers and dash'-' saved to and .mdb with field type as integer" Number"

Done some work on an app. Orignaly coded it to have the account number as integers in the .mdb database asInteger.
Now I need to use a phone number (111-111-1111) as the account number.
Problem is with a .mdb field set to integer"Number" it will not allow me to save a phonenumber to that field. What can I do to work around this. I do not want to use a memo for this.
Thanks
0
Grant Fullen
Asked:
Grant Fullen
3 Solutions
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
Change the data type to Text ... and allow enough characters for the number (Field Size).

mx
0
 
ALaRivaCommented:
instead of switching to text, leave it as number, but only type in the numbers, leave out the dashes, then add them in upon formatting of the field for display.

This will allow you to keep the numeric field, which provides for slightly faster indexing and searches.

HTH

- Anthony
0
 
rfwoolfCommented:
Best practise for telephone numbers is actually text / string fields because of things like country codes, area codes, extensions, etc, for example:
+27 (0)11 555 1234 ext 7

Your best bet is to convert the integer field to a text field. If that's not an option then consider ADDING another text field to the table that you can use for this purpose.
Finally if that's really not an option then you will have to validate all input to ensure only numbers are entered. You can use a TJvDBValidate edit (part of the JVCL component library - freeware and opensource) to stipulate what characters would be legal. There are other ways of doing this of course.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
ALaRivaCommented:
rfwoolf,
Your suggestion is true, but only for cases where international numbers are of concern.

Considering he is using the phone number as the account number, and he immediately provided an example in standard U.S. phone format, I doubt that he has internation phone number concerns.

And since the Account Number is something that would probably be indexed and searched upon regularly, the benefits of a number field would be best practice.

IMO.

- Anthony
0
 
Grant FullenAuthor Commented:
all can apply here.
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"Your suggestion is true, but only for cases where international numbers are of concern."

The suggestion is always true.  Same for zip codes.  And in neither of these cases will an Integer work because the largest size is 32,767 ... so ... forget that.  

mx
0
 
ALaRivaCommented:
You need to ease your attitude youngster, I was simply offering a differing opinion.

Not once did I say INTEGER.  I know the limits of an Integer, this isn't my first trip around the park.

I stand by my comments.

HTH
- Anthony
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
LOL ...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Tackle projects and never again get stuck behind a technical roadblock.
Join Now