I need to get rid of leading empty spaces...

Erik

Registered User.
Local time
Today, 22:49
Joined
May 16, 2000
Messages
19
I have an employees table that was imported from an excel file. It has FirstName, MI, LastName fields. Each of these fields has data entered in them with a blank space before the data entry. The last name Cross is entered like this: " Cross" instead of "Cross". Is there any kind of function that I can run in a query to get rid of these leading blank spaces. Thanks in advance to who ever can help out.

Erik
 
Give this function a try, it will do the job:

Public Function fRemoveSpaces(strEntry As Variant) As String
Dim strTemp As String
Dim x As Integer
If IsNull(strEntry) Then Exit Function
For x = 1 To Len(strEntry)
If Mid$(strEntry, x, 1) <> " " Then strTemp = strTemp & Mid$(strEntry, x, 1)
Next x
fRemoveSpaces = strTemp
End Function

HTH
RDH
 
Thanks to both of these suggestions. The suggestion from Pat was almost too obvious, that I am kicking myself for not trying that right off the bat. I did use the code of the first response from Jon and it worked well.

Erik Cross
 

Users who are viewing this thread

Back
Top Bottom