Tidy up text

  • Thread starter Thread starter Jordan Shoderu
  • Start date Start date
J

Jordan Shoderu

I have imported text that has a few extra spaces on the end
how do i remove the black spaces on the end the text in the records
 
Use the RTrim function to remove blanks from the end of a string, LTrim to
remove them from the beginning of a string, or Trim to remove them from both
ends.
 
Use a update query, and use the trim command:

update tblCustomers set Company = trim(Company)

If you are not comfortable typing in raw sql, then build a update query in
the query builder, and for the "update to" expression, simply type in:

Trim(Company)

ps - test this on a copy for the data since it is EASY to mess this up!
 
Jordan Shoderu said:
I have imported text that has a few extra spaces on the end
how do i remove the black spaces on the end the text in the records

Try this function:

Public Function DeleteChrs(strString As String, strChars As String) As
String
Dim i As Integer
Dim strOut As String
Dim str As String
strOut = ""
If ((Not IsNull(strString)) And (Not IsNull(strChars)) And _
(strString <> "") And (strChars <> "")) Then
For i = 1 To Len(strString)
str = Mid(strString, i, 1)
If (InStr(1, strChars, str) = 0) Then
strOut = strOut + str
End If
Next i
End If
DeleteChrs = strOut
End Function
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Arvin Meyer said:
Try this function:

Public Function DeleteChrs(strString As String, strChars As String) As
String
Dim i As Integer
Dim strOut As String
Dim str As String
strOut = ""
If ((Not IsNull(strString)) And (Not IsNull(strChars)) And _
(strString <> "") And (strChars <> "")) Then
For i = 1 To Len(strString)
str = Mid(strString, i, 1)
If (InStr(1, strChars, str) = 0) Then
strOut = strOut + str
End If
Next i
End If
DeleteChrs = strOut
End Function

Arvin: won't that remove ALL blanks in the string, not just those at the
end?
 
Except, that I doubt that they are actually spaces. If you read his post
again he mentions: "the black spaces on the end". Based on that statement, I
believe that they may be another character, as empty spaces are not black.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access Downloads
http://www.datastrat.com
http://www.mvps.org/access
 
Could be. As is obvious from the replies Albert & I posted, some of us read
that as "blank spaces"! <g>
 
Arvin Meyer said:
Except, that I doubt that they are actually spaces. If you read his
post again he mentions: "the black spaces on the end". Based on that
statement, I believe that they may be another character, as empty
spaces are not black.

Good thinking! But in this logic ...

.... I don't think it's possible for strString or strChars ever to be
Null, since the arguments are defined as String.
 
Except, that I doubt that they are actually spaces. If you read his post
again he mentions: "the black spaces on the end". Based on that statement, I
believe that they may be another character, as empty spaces are not black.
--


You have excellent "eagle" eyes. I am convinced to this day that I am
dyslexic....

The poster might in fact have meant blank...but on the other hand...I
certainly did not even hear, read, say or see the word "black" that was in
plain sight for all to read!
 
Sry guy i did right black but obviously meant blank
thanks i am about to apply this string and see if it works
i am a reg here so i know that it will
lol

thanks guys

Jordan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top