Results 1 to 8 of 8

Thread: UCase syntax

  1. #1
    New Lounger
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts

    UCase syntax

    I am just starting on access 2010 and am trying to understand how to use the Expression Builder.

    I have a field "Surname" that I wanted to apply the After Update method to change into uppercase but I am unsure how to write it.

    I have tried
    =StrConv([Surname],UCase([Surname]),1033)

    but am receiving the Mismatch error message.

    Can someone please advise the correct syntax.

    Thanks

  2. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,235
    Thanks
    202
    Thanked 796 Times in 729 Posts
    Gavin,

    Use an Event Procedure it's much easier.
    Code:
    Private Sub Location_AfterUpdate()
     [Location] = UCase([Location])
    End Sub
    Just select Event Procedure instead of Expression Builder and code as above. Note: It will create the stub you just need the 2nd line. HTH
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  4. The Following User Says Thank You to RetiredGeek For This Useful Post:

    Azar (2014-09-19)

  5. #3
    New Lounger
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thanks for that.
    That is what I have done for now but I still would prefer to embed the instruction into the form the way Expression Builder does it. That way the procedure goes with the form.

  6. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,235
    Thanks
    202
    Thanked 796 Times in 729 Posts
    Gavin,

    It does go with the form!
    vbe.JPG
    HTH
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  7. #5
    New Lounger
    Join Date
    Sep 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your problem isn't with the UCase function. StrConv has three arguments, a string, and two integers. In the example you gave, you have a string as the 2nd argument to StrConv -- this needs to be an integer:

    1 -- Uppercase
    2 -- Lowercase
    3 -- Proper case (lowercase, 1st letter of each word capitalized)
    4 -- Convert single-byte characters to double-byte characters (East Asia locales only)
    8 -- Convert double-byte characters to single-byte characters (East Asia locales only)
    16 -- Convert Hiragana characters to Katakana (Japan only)
    32 -- Convert Katakana characters to Hiragana (Japan only)
    64 -- Convert string to Unicode using default code page (not available on Macintosh)
    128 -- Convert string from Unicode to default code page (not available on Macintosh)

    For more information, check out the official information at http://office.microsoft.com/en-us/ac...001228915.aspx.

  8. #6
    New Lounger
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    1
    Thanked 0 Times in 0 Posts
    So I tried
    =StrConv([Surname],3)

    and still no good.

    Any suggestions please?
    thanks

  9. #7
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,497
    Thanks
    3
    Thanked 42 Times in 42 Posts
    There seems to be a disconnect here. RG showed you the correct syntax if you want to convert it to UPPER case using the UCase() function. Your statement would convert it to what is called Mixed case or Proper case because of the 3 parameter. In addition, the statement needs to be
    Code:
    [Surname] = StrConv([Surname],1)
    if you really want to use the StrConv() function.
    Wendell

  10. #8
    Star Lounger
    Join Date
    Feb 2009
    Location
    Kings Park, Victoria, Australia
    Posts
    80
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Another way is when in Table design, simply set the format for the field to show >, this will force every entry into the field to uppercase.

    Regards,
    Maria
    Maria
    Simmo7
    Victoria, Australia

Posting Permissions

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