Results 1 to 4 of 4
  1. #1
    eleyland is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2019
    Posts
    2

    Remove spaces after a field in report i.e forename

    Hello



    I hope someone can help, I would like to produce a letter in Access and as part of the letter I need to say [Forename]'s work has been very good etc - but I cannot work out how to remove the spaces if Forename is 5 or 20 characters, so the " 's work has been very good etc" does not line up well with forename.

    Does anyone know how to do this please in Access 2010 ?

    Thanks

    Elaine

  2. #2
    Join Date
    Jun 2015
    Location
    Wales. Land of the sheep.
    Posts
    1,228
    you have put the space into your text string.

    " 's work has been very good etc" should be
    "'s work has been very good etc"

  3. #3
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,387
    use the replace function and include the bits you want to replace in square or curly brackets

    so assuming your text is something like

    "and [forename]'s work as been [standard] and should [commendation]"

    in a query or as a controlsource to a control you would use a nested replace function

    replace(replace(replace,mytext,"[Forename]","Fred"),"[Standard]","has been very good"),"[Commendation]","receive a gold star")))

    in vba you could use a sequence of replace functions

  4. #4
    eleyland is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2019
    Posts
    2
    Thank you, I have ended up not using replace but just creating an expression in the query and printing that line.

    Thanks again

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

Similar Threads

  1. Replies: 4
    Last Post: 09-13-2018, 10:21 AM
  2. How to remove extra spaces from a field?
    By accessmatt in forum Queries
    Replies: 1
    Last Post: 09-22-2014, 06:57 AM
  3. Remove blank spaces after strings in fields
    By Modify_inc in forum Access
    Replies: 8
    Last Post: 08-18-2012, 06:30 PM
  4. Adding leading spaces to a field
    By johnbr in forum Queries
    Replies: 1
    Last Post: 12-13-2011, 11:31 AM
  5. Find Spaces in Field
    By stottle in forum Queries
    Replies: 6
    Last Post: 08-17-2009, 02:02 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