I am trying to clean the data from my address field and wanted to do somthing like this:
Sub Add_Update()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Address"
rs.MoveFirst
Do Until rs.EOF
If rs!Add2 = Null Then
rs.MoveNext
ElseIf rs!Add2 Like "*Avenue*" Then
rs.Edit
rs!Add2 = "*Ave.*"
rs.Update
ElseIf rs!Add2 Like "*Street*" Then
rs.Edit
rs!Add2 = "*St.*"
rs.Update
End If
rs.MoveNext
Loop
MsgBox "Update is Done . . . . Thank you"
End Sub
The problem is that its replacing th whole filed with "Ave. or St.. . .
how can I re-write the module so it only replaces the word within the string in the address field,
thanks
erwin
Sub Add_Update()
Dim db As Database
Dim rs As Recordset
Set db = CurrentDb()
Set rs = db.OpenRecordset("Address"
rs.MoveFirst
Do Until rs.EOF
If rs!Add2 = Null Then
rs.MoveNext
ElseIf rs!Add2 Like "*Avenue*" Then
rs.Edit
rs!Add2 = "*Ave.*"
rs.Update
ElseIf rs!Add2 Like "*Street*" Then
rs.Edit
rs!Add2 = "*St.*"
rs.Update
End If
rs.MoveNext
Loop
MsgBox "Update is Done . . . . Thank you"
End Sub
The problem is that its replacing th whole filed with "Ave. or St.. . .
how can I re-write the module so it only replaces the word within the string in the address field,
thanks
erwin