Results 1 to 6 of 6
  1. #1
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    formatting mixed-case textbox (2000/SP-3)

    I have an unbound text box on a form used for printing hard copies of cards used for filing purposes. The text box, which gets its data from 3 fields in the form's underlying query, has its Control Source set to :
    =[LastName] & ", " & [FirstName] & " " & [MiddleName]

    I would like to print the entire LastName field appearing in all capitals with the FirstName and MiddleName fields appearing in the normal mixed upper and lowercase. i.e.;
    JONES, James Earl

    Anybody out there have any suggestions?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: formatting mixed-case textbox (2000/SP-3)

    try

    =UCase([LastName] )& ", " & strconv([FirstName] , 3)& " " & strconv([MiddleName] ,3 )

    The UCase function converts to Upper Case

    The Strconver function will do a range of conversions. The 3 tells it to convert to Proper Case
    You could replace UCase in the above with another strconvert but use strConvert([Lastname],1)
    Regards
    John



  3. #3
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: formatting mixed-case textbox (2000/SP-3)

    John,
    Excellent! excellent! excellent! Many thanks. I appreciated the explanation too. I am obviously not a veteran. I found one little glitch in my records appeared when first or middle names were hyphenated. So, I changed your expression to:
    =UCase([LastName]) & ", " & [FirstName] & " " & [MiddleName]
    ...and now it works just fine.
    This also solved a similar problem when nicknames, that I have the habit of putting in parenthesis, were added. Since now the first letter of the name was actually the second letter of the word, it always appeared as lowercase... Just thought you might like to put that into your 'bag of tricks' for future reference. John, thanks again. Your lounge is great!
    Brady

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: formatting mixed-case textbox (2000/SP-3)

    OK so you want Smith-Jones to appear that way, and Strconv("Smith-Jones",3) gives you Smith-jones?

    I don't know a way around that, but the Strconv is optional. I put it it in because it fixes mistakes in the way you enter names most of the time.
    Regards
    John



  5. #5
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: formatting mixed-case textbox (2000/SP-3)

    All is perfect now. Thanks again John.
    Brady

  6. #6
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: formatting mixed-case textbox (2000/SP-3)

    I don't think there is a way around that. I don't use the ProperCase because it just causes too many problems. McHenry gets changed to Mchenry, etc. I wrote my own function that more intelligently determines when something should be capitalized, and doesn't uncapitalize anything that is already capitalized. It still fails on "e.e. cummings", but we all have to live with that one! <img src=/S/laugh.gif border=0 alt=laugh width=15 height=15>
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

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