• UCase syntax

    Author
    Topic
    #496132

    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

    Viewing 3 reply threads
    Author
    Replies
    • #1465177

      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 :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

      • #1465266

        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.

    • #1465293

      Gavin,

      It does go with the form!
      37726-vbe
      HTH :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1466240

      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/access-help/strconv-function-HA001228915.aspx.

      • #1466457

        So I tried
        =StrConv([Surname],3)

        and still no good.

        Any suggestions please?
        thanks

      • #1466740

        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

    • #1466645

      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.

    Viewing 3 reply threads
    Reply To: UCase syntax

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

    Your information: