ADDRESS_1 (BEFORE )
76TH ST AVENUE
8808 RIVER PINES CT AVENUE 101
8730 CEDROS AVENUE APT G
ADDRESS_1 ( AFTER RUNNING THE CODE)
76TH ST VENUEAVE
8808 RIVER PINES CT AVENUE 101
8730 CEDROS VENUE APT GAVE
Can someone take a look at this code: I want to search and replace AVENUE with AVE. I am aware of the EDIT>REPLACE but i really would like to do this in VBA. I am Usesing 97. . . thanks
Dim Rep As String
Dim strTemp As String
Dim intAt As Integer
Dim intLength As Integer
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("AddressP"
rs.MoveFirst
Do Until rs.EOF
intLength = Len(rs!ADDRESS_1)
If InStr(rs!ADDRESS_1, "AVENUE" > 0 Then
For intAt = 1 To intLength
If Mid(rs!ADDRESS_1, intAt, Len("AVENUE") = "AVENUE" Then
strTemp = strTemp + ( "AVE"
Else
strTemp = strTemp & Mid(rs!ADDRESS_1, intAt, 1)
End If
Next intAt
rs.Edit
rs!ADDRESS_1 = strTemp
Rep = strTemp
rs.Update
rs.MoveNext
End If
rs.MoveNext
strTemp = ""
Loop
MsgBox " UPDATE DONE"
End Sub
76TH ST AVENUE
8808 RIVER PINES CT AVENUE 101
8730 CEDROS AVENUE APT G
ADDRESS_1 ( AFTER RUNNING THE CODE)
76TH ST VENUEAVE
8808 RIVER PINES CT AVENUE 101
8730 CEDROS VENUE APT GAVE
Can someone take a look at this code: I want to search and replace AVENUE with AVE. I am aware of the EDIT>REPLACE but i really would like to do this in VBA. I am Usesing 97. . . thanks
Dim Rep As String
Dim strTemp As String
Dim intAt As Integer
Dim intLength As Integer
Dim rs As Recordset
Dim db As Database
Set db = CurrentDb
Set rs = db.OpenRecordset("AddressP"
rs.MoveFirst
Do Until rs.EOF
intLength = Len(rs!ADDRESS_1)
If InStr(rs!ADDRESS_1, "AVENUE" > 0 Then
For intAt = 1 To intLength
If Mid(rs!ADDRESS_1, intAt, Len("AVENUE") = "AVENUE" Then
strTemp = strTemp + ( "AVE"
Else
strTemp = strTemp & Mid(rs!ADDRESS_1, intAt, 1)
End If
Next intAt
rs.Edit
rs!ADDRESS_1 = strTemp
Rep = strTemp
rs.Update
rs.MoveNext
End If
rs.MoveNext
strTemp = ""
Loop
MsgBox " UPDATE DONE"
End Sub