REPLACE blank space in field.

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

REPLACE blank space in field.

Post by sal21 »

In field NOME of Acces table i can have, see the txt attached.

The first value is the surname and second is the name.
Naturally from name and surname i need one only space :grin:

How to delete the "surplus" spcace from name and surname and maintain only one?

Naturally dont check if in the field are the surname and name with only one space.
You do not have the required permissions to view the files attached to this post.
Last edited by sal21 on 06 Nov 2013, 07:47, edited 1 time in total.

User avatar
Claude
cheese lizard
Posts: 6241
Joined: 16 Jan 2010, 00:14
Location: Sydney Australia

Re: REPLACE blank space in filed.

Post by Claude »

without having looked at your attachment, I think you're trying to get rid of "white spaces" which http://www.editpadpro.com/; an editor I've bought and used for decades, does exactly that in no time at all.
Cheers, Claude.

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

Re: REPLACE blank space in filed.

Post by sal21 »

Claude wrote:without having looked at your attachment, I think you're trying to get rid of "white spaces" which http://www.editpadpro.com/; an editor I've bought and used for decades, does exactly that in no time at all.
but I refer my post on a field in Access table.

I have post a question in:
Portal » Board index ‹ Office Applications ‹ Access/SQL

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: REPLACE blank space in field.

Post by HansV »

You can run an update query:

Code: Select all

UPDATE Test1 SET Nome = Replace(Replace(Replace([Nome],"  "," *"),"* ",""),"*","");
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

Re: REPLACE blank space in field.

Post by sal21 »

HansV wrote:You can run an update query:

Code: Select all

UPDATE Test1 SET Nome = Replace(Replace(Replace([Nome],"  "," *"),"* ",""),"*","");

as usual your code work fine!

But instead to use a query, my real question is:

i get a string data with:

PRES = Trim(mid(MyString, 10, 50))

is possible to check if in PRES are present more of 2 space in data string, and delete the "surplus" space before to insert PReS in filed?

e

User avatar
HansV
Administrator
Posts: 78549
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: REPLACE blank space in field.

Post by HansV »

You can use

Code: Select all

PRES = Replace(Replace(Replace(Trim(Mid(MyString, 10, 50)),"  "," *"),"* ",""),"*","")
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4364
Joined: 26 Apr 2010, 17:36

Re: REPLACE blank space in field.

Post by sal21 »

HansV wrote:You can use

Code: Select all

PRES = Replace(Replace(Replace(Trim(Mid(MyString, 10, 50)),"  "," *"),"* ",""),"*","")

no words!
work perfect.
Tks.