Share via

Space remove query

Anonymous
2010-07-22T23:17:57+00:00

Sometimes there are blank spaces at the beginning of a field is there a query that will search for and remove them?

Table:[NameList].Notes

Thanks!

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2010-07-23T00:14:25+00:00

You can execute an update query to remove them, but are you sure they're spaces? They may be other characters that only look like spaces.

Let's assume they are spaces, the following will remove them (from the named field only):

UPDATE myTable SET myField = Trim(myField)

If after running the above query, you still see spaces, then they're not real spaces. In that case you need to find out what they are. To do that, you can run the following query:

SELECT myField, Asc(Left(myField, 1)) As MyFunnySpace

FROM myTable WHERE (myField NOT LIKE "[a-z]*") AND (myField NOT LIKE "[A-Z]*") AND (myField NOT LIKE "[0-9]*)

This will give you the ASCII code of the character in question. If it's not 32 (a space), then you can use the following reference (http://www.asciitable.com/) to find out what it is. Once you know what the ASCII character is, you can use a query to get rid of it.

UPDATE myTable SET myField = Replace(myField, ascii_code_to_get_rid_of, "")

"wav1" wrote in message news:*** Email address is removed for privacy *** .com...

Sometimes there are blank spaces at the beginning of a field is there a query that will search for and remove them?

Table:[NameList].Notes

Thanks!

 


Regards, Graham R Seach Microsoft Access MVP Sydney, Australia

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Anonymous
2010-07-23T00:13:52+00:00

UPDATE [NameList] SET Notes= Trim(Notes) WHERE Notes Like " *"

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful