Results 1 to 5 of 5

Thread: How can I format a field

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary
    Posts
    273

    How can I format a field

    My database is in Access and I need to format a field like this

    HomePhone = " (###) ###-####

    because the field print just like this whithout format

    9999999999

    How can I format this field and were, please



    Thank in advance
    mannyso

  2. #2
    Hyperactive Member
    Join Date
    Oct 2000
    Location
    Sydney Australia
    Posts
    476
    I assume you want to display this on a form.
    There is an easier way but I can't find it.
    Here's a work around
    VB Code:
    1. Text0 = "(" & Left(theNumber, 3) & ")" & Mid(theNumber, 4, 3) & "-" & Mid(theNumber, 7)
    You may have to fiddle with the edges but this will work.
    To control input do a serch for mask in the help
    FW

  3. #3
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    How about:
    VB Code:
    1. MsgBox Format("0123456789", "(000) 000-0000")
    will yield: (012) 345-6789


    Just note; that a 6 digit number (123456) will become: (000) 012-3456

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2001
    Location
    Calgary
    Posts
    273
    Thank you for your response

    The two example are correct and these work only on a form but, what about a report? I want to display on the report these fields. I can not find a way how to use it. I dont know if I have to use a formula?
    mannyso

  5. #5
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    India
    Posts
    342
    u can use a formula to do that..left , mid and right functions are availble in crystal rep also..
    if the field is a number .. then first use 'totext' function to convert the number to text ..
    ksm

Posting Permissions

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



Click Here to Expand Forum to Full Width