Excel_Kid1081
Registered User.
- Local time
- Today, 15:52
- Joined
- Jun 24, 2008
- Messages
- 34
Hello-
I am trying to create a VBA code that loops through each field in a table and for record cleans the data (string data with extra spacing).....
Here is the code I got so far....nothing too crazy but having trouble...
Any ideas are much appreciated!
Thanks!
EK
I am trying to create a VBA code that loops through each field in a table and for record cleans the data (string data with extra spacing).....
Here is the code I got so far....nothing too crazy but having trouble...
PHP:
Sub Test()
Dim db As Database
Dim rs As DAO.Recordset
Dim fldLoop As DAO.Field
Dim icount As Long
Set rs = CurrentDb.OpenRecordset("tblTest1", dbOpenDynaset)
'Loop through all records in each column
For Each fldLoop In rs.Fields
With rs
Do Until rs.EOF
.Edit
!fldLoop = Clean(fldLoop)
.Update
rs.MoveNext
Loop
End With
Next fldLoop
rs.Close
Set fldLoop = Nothing
Set rs = Nothing
Set db = Nothing
End Sub
Any ideas are much appreciated!
Thanks!
EK