Results 1 to 7 of 7
  1. #1
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88

    VbProperCase Change

    I have created this After Update code to generate proper text formatting so when someone enters a name it capitalizes the first letter in each name. (i.e. jane smith it would be viewed as Jane Smith. Code does perfect for that; however when I add parentheses to show maiden name it throws it off. The current after update event code below leaves it as Jane (jones) Smith. I would like it to read Jane (Jones) Smith
    This Is My Current Code:
    Private Sub MothersNameMaiden_AfterUpdate()
    MothersNameMaiden = StrConv(MothersNameMaiden, (vbProperCase)
    End Sub

    Thanks All For your help and consideration.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I would not put maiden name in the same field. Name parts should be in separate fields anyway: FirstName, LastName, Middle

    If you really want single field, then will probably need custom VBA function procedure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    And you have an extraneous parentheses. Take out the one in red:

    MothersNameMaiden = StrConv(MothersNameMaiden, (vbProperCase)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    I agree with you June but in order for some things to eventually transfer I need it to read with maiden name on same line. It reverts back to how it appears on a death certificate. Do you know what VB code would look like to accomplish this task? As it stands now with current code even if I type it in as Jane (Jones) Smith it changes it to Jane (jones) Smith

    Private Sub MothersNameMaiden_AfterUpdate()
    MothersNameMaiden = StrConv(MothersNameMaiden, vbProperCase)
    End Sub

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    As I posted at the duplicate post located here

    http://www.dbforums.com/microsoft-ac...sing-code.html

    The problem, of course, is that Access is interpreting the opening parens as the first 'letter' and not the actual first letter of the maiden name. This does the job for me:

    Code:
    Private Sub MothersNameMaiden_AfterUpdate()
    
      Me.MothersNameMaiden = Replace(Me.MothersNameMaiden, "(", "( ")
    
      Me.MothersNameMaiden = StrConv(Me.MothersNameMaiden, vbProperCase)
    
      Me.MothersNameMaiden = Replace(Me.MothersNameMaiden, "( ", "(")
    
    End Sub

    Linq ;0)>

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I would store the data in separate fields then concatenate in query when needed. It is easier to combine fields than to manipulate strings. Linq's suggestion is very clever.

    However, what do you want to do with something like: o'connor
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    wes9659 is offline Advanced Beginner
    Windows 8 Access 2010 64bit
    Join Date
    Apr 2014
    Location
    Dover, Ohio
    Posts
    88
    Private Sub MothersNameMaiden_AfterUpdate()

    Me.MothersNameMaiden = Replace(Me.MothersNameMaiden, "(", "( ")

    Me.MothersNameMaiden = StrConv(Me.MothersNameMaiden, vbProperCase)

    Me.MothersNameMaiden = Replace(Me.MothersNameMaiden, "( ", "(")

    End Sub


    Works perfect!! Thank you I see now what you mean about code seeing ( as the first letter. Which then forced it to lower case.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Change Change FormHeader Color
    By burrina in forum Forms
    Replies: 4
    Last Post: 12-19-2012, 08:18 PM
  2. Replies: 3
    Last Post: 07-20-2012, 11:41 AM
  3. On change
    By clarkej in forum Forms
    Replies: 3
    Last Post: 01-19-2011, 08:33 AM
  4. Using VBA to change VBA
    By Desstro in forum Programming
    Replies: 14
    Last Post: 11-13-2010, 05:17 PM
  5. Name Change
    By skip17 in forum Access
    Replies: 0
    Last Post: 01-12-2009, 01:28 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums