Results 1 to 6 of 6
  1. #1
    Join Date
    Jan 2004
    Posts
    145

    Unanswered: Field Formatting

    I have a phone number field(string) that I want to be stored in this format "(999) 999-9999". But I only want the user to have to enter the numbers. So in the table for the phone number field I specified the input mask and indicated it should store the literals: "!(999) 999-9999;0;' '". I checked the table and it seemed to work. I ran a report based on the table and everything was good.The problem occurs when I base a recordset on the table or run a make-table query based on the original table. When I do either only the numbers are stored. So apparently the literals aren't actually being stored or something. Does anyone know why this is?

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I just tried this in 97 and it worked. I created a table with a telephone number that included the input mask, then create a table with a Make Table query and the new table has the literals. What version are you using?

  3. #3
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    it's meant to be like that.
    makes no sense to store "-" and "(" and " "

    investigate format() & format$() in help

    izy
    currently using SS 2008R2

  4. #4
    Join Date
    Jan 2004
    Posts
    145
    I am using Access 2003. I guess the real reason I need it is when creating strings from the fields. I would like to append the phone number to a string, but what will happen is this 'Phone Number: 1234567890' instead of 'Phone Number: (123) 456-7890'. So it would be convenient if the data was actually stored with the literals. I can use format(), but that would mean changing some existing code. If I could find an easier way then that would be nice.

  5. #5
    Join Date
    Sep 2004
    Location
    Charlotte, NC
    Posts
    164
    Izy is right; why store the parentheses and dashes. When you need it for the string that you mentioned, just make it:

    "Phone Number: "& format([your field],"(999) 999-9999")

    TD

  6. #6
    Join Date
    Jan 2004
    Posts
    145
    I thought I explained why I want this. Anyway it looks like if I use the mask on the control and specify that it should store the literals it works.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •