Results 1 to 7 of 7
  1. #1
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287

    Change "Allie/shawn" to "Allie & Shawn"

    Hey guys,



    I have a table (pic shown) of a customer list, obviously with most data not shown for privacy reasons.
    Click image for larger version. 

Name:	names.jpg 
Views:	10 
Size:	44.9 KB 
ID:	13948
    Our sales get keyed in in all caps. Also, when a couple purchases, their name is keyed as FNAME1/FNAME2.

    I have a query series that finds each customer that has spent $5000+, puts their names and address into Sentence Case, and then exports to word for a mail merge for mailings that I sign and send out.

    For couples, the letters look like crap with the slash combined with what sentence case does to it.

    How could I find all records with a "/" and replace it with " & " and turn make the first letter of the second name a capital?

    This gets done once a month, and it is on all new data. A UDF would be fine, almost preferred.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    You can use the Replace() function in an update query to actually change the data, if that's what you're after.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Ah got it! Used Len() and InStr() to separate them and made a UDF to capitalize the first letter.

    EDIT: Investigating the Replace() function, but marking as solved. Appreciate it!

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    You could change the second name to start with a capital Using the StrConv() function.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    The Replace() function would be far more efficient, though it wouldn't handle the capitalization. I would think you could do that with the StrConv() function, like StrConv(Replace(...)) with all the proper arguments of course.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #6
    snipe's Avatar
    snipe is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    287
    Thanks for the replace idea..

    StrConv(Replace("Bob/barbara","/"," & "),3)

    Stupid amounts of simple.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    No problem.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 30
    Last Post: 09-27-2013, 01:34 PM
  2. Replies: 2
    Last Post: 11-14-2012, 04:47 PM
  3. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  4. Replies: 11
    Last Post: 03-29-2012, 02:32 PM
  5. Replies: 16
    Last Post: 07-22-2011, 09:23 AM

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