I'm having trouble using the Replace function (in my newly installed Access2002) to replace two spaces " " with one " ". This is to correct address style errors on an input form.
Replace is working with my other substring replacements, and I've already tried using a variable string to represent " " just for fun. There's no error--it just doesn't replace the double-spaces.
I can locate the double-spaces using InStr and get this taken care of by looping Do While Not IsNull(InStr(sMyStr, " ")). But I would rather use Replace if possible--it's prettier code, and I can't imagine why it will not work. (This reminds me of fighting the " ' ' " " ' "s!)
sTemp = Trim(Me.Address)
sTemp = Replace(sTemp, " street", " st")
sTemp = Replace(sTemp, " lane", " ln")
sTemp = Replace(sTemp, " road", " rd")
.....
sTemp = Replace(sTemp, " ", " ")
Replace is working with my other substring replacements, and I've already tried using a variable string to represent " " just for fun. There's no error--it just doesn't replace the double-spaces.
I can locate the double-spaces using InStr and get this taken care of by looping Do While Not IsNull(InStr(sMyStr, " ")). But I would rather use Replace if possible--it's prettier code, and I can't imagine why it will not work. (This reminds me of fighting the " ' ' " " ' "s!)
sTemp = Trim(Me.Address)
sTemp = Replace(sTemp, " street", " st")
sTemp = Replace(sTemp, " lane", " ln")
sTemp = Replace(sTemp, " road", " rd")
.....
sTemp = Replace(sTemp, " ", " ")