98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Access Training and help » Access
Access
Resolved · Urgent Priority · Version 2003
Chrisa has attended:
Access Advanced course
Access
How can you automatically delete spaces in between words?
RE: Access - Remove spaces between words
Hi Chrisa,
I found the function to do this with: REPLACE
Replace([PostCode]," ","")
With [PostCode] the field, the first paramater is what to find, in this case a space " ", and the second paramater is what to replace it with, in this case with nothing "".
Example
Field: PostCode
DT11 8ST would return DT118ST
BH1 2HT would return BH12HT
etc.
Cheers,
Kristin
------------------
Access Replace function:
http://www.techonthenet.com/access/functions/string/replace.php
Replace ( string1, find, replacement, [start, [count, [compare]]] )
string1 is the string to replace a sequence of characters with another set of characters.
find is the string that will be searched for in string1.
replacement will replace find in string1.
start is optional. This is the position in string1 to begin the search. If this parameter is omitted, the Replace function will begin the search at position 1.
count is optional. This is the number of occurrences to replace. If this parameter is omitted, the Replace function will replace all occurrences of find with replacement.
compare is optional. This can be one of the following values:
-------
RE: Access - Remove spaces between words
Thanks Kirstin!
Chrisa :)
RE: Access - Remove spaces between words
Hi Chrisa,
Pleasure. You have to write the function in a new column in the Query Design Window as a new expression, e.g. Expr1: Replace([PostCode]," ","")
When you run the query, you'll then have a field 'PostCode' and a field 'Expr1'.
You can rename Expr1 to a more descriptive name, e.g. PostCodeCompact: Replace([PostCode]," ","").
You can then either save the query with this new expression field in it; or create a new field in the table for it or replace the existing Post Code values with the new compacted values by using an Update Query. If you do want to update it into another field, then only paste Replace([PostCode]," ","") into the 'Update To' line, without the name of the expression.
Let me know if you got it to work.
Cheers,
Kristin
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Access tip:Modal formsIf you have created a form / switchboard and dont want people to get away from using the switchboard, you can change the form properites for Modal to On. |