• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 512
  • 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 MVP, Access and Data Platform)Commented:
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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
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 MVP, Access and Data Platform)Commented:
"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 MVP, Access and Data Platform)Commented:
LOL ...
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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