• I need an Input Mask

    Author
    Topic
    #1768052

    Does anyone know the Access input mask to do the following

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

    Your help is appreciated.

    Dave

    Viewing 1 reply thread
    Author
    Replies
    • #1777440

      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!

      • #1777443

        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

        • #1777444

          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.

          • #1777445

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

            • #1777446

              Sorry, but wouldn’t you need to define a vbProper function to do it that way? Or am I missing something.

            • #1777450

              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!

          • #1777494

            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->…..

        • #1777515

          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.

          • #1777517

            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().

            • #1777694

              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?

            • #1777722

              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.

    • #1777863

      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.

      • #1777868

        The Access Web, which is what http://www.mvps.org/access%5B/url%5D 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.

    Viewing 1 reply thread
    Reply To: I need an Input Mask

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: