Can anyone advise if there is a way to import an MS Access table which has a multi line comment field into a single lined field ie. get rid of the carriage returns on import?
Can you please explain the above code and also why I would need to pass the table and field name to the procedure. Would I not just include it in the sql statement?
Added a button on a form to execute your code supplied and the below works:
Private Sub cmdReplaceText_Click()
Call RemoveCrLf("zz", "txtDescription")
End Sub
Sub RemoveCrLf(TableName, FieldName)
Dim mySQL As String
mySQL = "UPDATE [" & TableName & "] SET [" & TableName & "].[" & FieldName & "] = Replace(nz([" & TableName & "].[" & FieldName & "],''),Chr(13) & Chr(10),'');"
CurrentDb.Execute mySQL
End Sub
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.