Results 1 to 14 of 14
  1. #1
    didwat
    Guest

    I need an Input Mask

    Does anyone know the Access input mask to do the following

    Convert (GENERAL MOTORS INC. to General Motors Inc.)

    Your help is appreciated.

    Dave

  2. #2
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    I don't know of a mask to do this but you could do it in code in the forms BeforeUpdate event. However make certain you always want: The Words Formatted With Starting Capital Letter and Not With One Word In The Middle With A Small Letter!

  3. #3
    didwat
    Guest

    Re: I need an Input Mask

    Thanks Andy,

    How Ironic the first time I use woody's lounge a swiss person responds. I work for a laseer manufacturer in the US but there production is located in THUN.

    Thanks for the advice but the downside is I do not know VB very well. Will it be a lot of code?

    Thanks for the help

    Dave

  4. #4
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    Actually, I think you want to put it in the AfterUpdate event for the control. Not too tough. AfterUpdate Code like: : Me.YourControl = StrConv(Me.YourControl, vbProperCase) Hope that helps. [img]/w3timages/icons/smile.gif[/img]

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    me.yourControl = vbProper(me.yourControl)
    works too

  6. #6
    4 Star Lounger
    Join Date
    Dec 2000
    Location
    London, Ontario, Canada
    Posts
    437
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    Sorry, but wouldn't you need to define a vbProper function to do it that way? Or am I missing something. [img]/w3timages/icons/frown.gif[/img]

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Cornwall, England
    Posts
    393
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    I am sure i set this for someone a while ago but the only way i can get it to work now is using the excel function. (maybe that was in excel and i am getting confused !?)
    anyway this works:

    Dim x As String
    Dim objXapp As Excel.Application

    Me.Address1.SetFocus

    Set objXapp = New Excel.Application
    x = Me.Address1.Text
    x = objXapp.WorksheetFunction.Proper(x)
    Me.txtUPPER.SetFocus
    Me.txtUPPER.Text = x

    Set objXapp = Nothing

    but is a heap of code to do something simple - ignore my previous post , Brian's solution is more suitable.
    sorry for the confusion!
    [img]/w3timages/icons/sad.gif[/img]

  8. #8
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    Yes you are right. I worried too much about AftrUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->FormatControl->AfterUpdate->.....

  9. #9
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    Actually I'm English despite living in Switzerland.

    Your example of GENERAL MOTORS INC converted to General Motors Inc. Fine What if the firm is ABB and that is EXACTLY how the firm name is spelt, not Abb.[img]/w3timages/icons/crybaby.gif[/img]

  10. #10
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: I need an Input Mask

    Then you need a ProperLookup function that uses a table of values with exactly the format you want to use for that "word". Then you propercase a string, and then lookup each word in that string to see if it has a match in your table. If it does, you replace that word in the string with the value from the table. Over the years, most of us have written our own versions of this, but doing so is simplified in Office 2000 by the introduction of functions like Replace().
    Charlotte

  11. #11
    4 Star Lounger
    Join Date
    Jan 2001
    Location
    Altnau, Thurgau, Switzerland
    Posts
    447
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    Hi Charlotte, your response has been bugging me over the weekend.
    I'm missing something in the logic here. Does this not mean you have to have a table with all the entries in before you can enter something for it to be validated?
    For example.
    General Motors Inc. is correct.
    Then you want to enter SPECIFIC MOTORS INC. spelt like that. Would not your code convert it to SPECIFIC Motors Inc unless SPECIFIC MOTORS INC was already entered in the lookup table? If the system did convert it to the mis-spelt version then how does the user get around that and enter it correctly? At some point someone has to enter it correctly.
    The way I see it could work is if one can purchase lists of preformatted information but why then enter it, why not select from this purchased list?

  12. #12
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: I need an Input Mask

    Ordinarily, you build the table yourself and create a maintenance screen so that users can add their own entries to it. As an alternative, you could purchase a list, but you then have to point your properlookup function at that list. Since purchased lists can run into tens of thousands of companies, and not all of them would have special instances of capitalization, you'd be better off with a custom table. It would be faster (fewer entries) and you could customize it as desired.
    Charlotte

  13. #13
    Lounger
    Join Date
    Jan 2001
    Posts
    39
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: I need an Input Mask

    You may want to take a look at this site:

    http://www.mvps.org/access/strings/str0008.htm

    It has lots of useful code ready to go. Might be just the type of thing Charlotte is talking about.

    Hope this helps.

    Rich P.

  14. #14
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: I need an Input Mask

    The Access Web, which is what http://www.mvps.org/access is called, is always a good place to look for handy code and tips. Just be careful to get code for your version of Access, or be prepared to modify it to make it work. Most of what's currently posted there is for Access 97.
    Charlotte

Posting Permissions

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