Results 1 to 4 of 4
  1. #1
    Star Lounger
    Join Date
    Jul 2007
    Location
    North Carolina, USA
    Posts
    71
    Thanks
    5
    Thanked 0 Times in 0 Posts

    format (first caps, all caps, exc..) (2003)

    Is there a good reference for setting the formatting on fields in my tables. I have several users who access my database, each has there own style for entering data and after only a week of production with the new database, it is looking pretty sloppy because they are all using different formats. I would like to set the fields on the form to automatically change if they type all lower case to first letter caps or all caps. Also, I would like to restrict a character in a phone number field, we have some users who want to use "." instead of the normal "-" for typing phone numbers. Any help or reference for doing these types of tasks would be appreciated. I looked through my books and can't seem to find what I am looking for. I don't want the cell to force CAPS or Characters to be entered, I want it to adjust automatically. Thanks.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: format (first caps, all caps, exc..) (2003)

    For phone numbers, you can use an input mask
    - Open the form in design view.
    - Select the text box for the phone number.
    - Activate the Data tab of the Properties window.
    - Click in the Input Mask property.
    - Click the ... button on the right hand side.
    - Select Phone Number from the list of input masks.
    - Click Next.
    - You can specify which character you want to display as placeholder. Default is an underscore _.
    - Click Next.
    - You can specify whether the parentheses, spaces and dashes will be stored in the field or not.
    - Click Finish.

    For names, addresses etc. you have different options:

    1) Set the Format property of the text box to > (a "greater than" character). The text will be stored the way it is entered, but it will be displayed on screen (and in print) in upper case.

    2) Write an After Update event procedure for the text box. For example for a text box named txtLastName:

    Private Sub txtLastName_AfterUpdate()
    Me.txtLastName = StrConv(Me.txtLastName, vbProperCase)
    End Sub

    This will convert the value to proper case, and the value will be stored that way, so it's not just for display. For example, hope law will be converted to Hope Law.
    StrConv doesn't handle names like O'Brien and MacArthur properly, you'd need more complicated code for that. Post back if you are interested, there have been several threads about the subject/

  3. #3
    Star Lounger
    Join Date
    Jul 2007
    Location
    North Carolina, USA
    Posts
    71
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Re: format (first caps, all caps, exc..) (2003)

    I did the input mask for the phone number and it was forcing the user to type the characters, not sure if I was doing something wrong, but I can re-try that one.

    I didn't set the format on my table, but I went to the field on my form where the user enters the names in and set the format to >, when we reopened the form it wouldn't allow them to type anything.
    I thought I was doing something wrong so I posted for help on this one.

    I do appreciate your help on this.

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: format (first caps, all caps, exc..) (2003)

    Are you sure you that you set the Format property to > ? If you did, you should still be able to enter or edit the value.

Posting Permissions

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