Hi,
New to using VBA. When I run this macro, it only processes the first record. I don't know what I am doing here! UGH!
What is wrong with this picture? (Comments are my attempt to keep things straight)Sub RemoveChar()
Dim rstTbl As DAO.Recordset
Dim strNewMfg As String
Dim strNewVendor As String
Dim strNewPart As String
Dim myMStr As String
Dim myVStr As String
Dim myPStr As String
Dim char As Variant
Set rstTbl = CurrentDb.OpenRecordset("Inventory", dbOpenDynaset)
myMStr = rstTbl![MfgPartNumber]
myVStr = rstTbl![VendorPartNumber]
strNewMfg = myMStr
strNewVendor = myVStr
strNewPart = myPStr
'----------------------------------With---------------------------
With rstTbl
.MoveFirst
'-----------------------------If 2------------------------
If Not rstTbl.BOF And Not rstTbl.EOF Then
'--------------------DO Until----------------
Do Until rstTbl.EOF = True
'-----------For Each----------
For Each char In Split(SpecialCharacters, ",")
strNewMfg = Replace(strNewMfg, char, "")
strNewVendor = Replace(strNewVendor, char, "")
'------If 1-----
If strNewMfg = strNewVendor Then
rstTbl.Edit
rstTbl![PartNumber] = strNewMfg
rstTbl.Update
Else
rstTbl.Edit
rstTbl![PartNumber] = strNewMfg & " - " & strNewVendor
rstTbl.Update
End If
'---End If 1-----
Next
'-------------Next------------
'--------------------Exit DO Until----------------
Exit Do
Loop
'--------------------Loop----------------
End If
'-------------------------End If 2------------------------
End With
'------------------------------End With-------------------------
End Sub
Thank you!
Rosa