Machiaveli
Programmer
Hello,
Could somebody help me adjust my code below. I would like to automatically insert the record of multiple tables to another table.
For each record, after the first four columns there should be an carriage return so that the records can be transformed.
Here's the code:
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim CC As Long
Dim fd As DAO.Field
Set rs = CurrentDb.OpenRecordset("Select * From table1")
Set rs1 = CurrentDb.OpenRecordset("Select * From tblLengths")
Do Until rs.EOF
On Error Resume Next
For Each fd In rs.Fields
With rs1
.AddNew
!FieldName = fd.Name
!Fieldvalue = fd.Value
!FieldLength = Len(fd.Value)
.Update
End With
'Debug.Print fd.Name & " : " & Len(fd.Value)
CC = CC + Len(fd.Value)
Next fd
rs.MoveNext
Loop
Set rs = Nothing
Set rs1 = Nothing
Could somebody help me adjust my code below. I would like to automatically insert the record of multiple tables to another table.
For each record, after the first four columns there should be an carriage return so that the records can be transformed.
Here's the code:
Dim rs As DAO.Recordset
Dim rs1 As DAO.Recordset
Dim CC As Long
Dim fd As DAO.Field
Set rs = CurrentDb.OpenRecordset("Select * From table1")
Set rs1 = CurrentDb.OpenRecordset("Select * From tblLengths")
Do Until rs.EOF
On Error Resume Next
For Each fd In rs.Fields
With rs1
.AddNew
!FieldName = fd.Name
!Fieldvalue = fd.Value
!FieldLength = Len(fd.Value)
.Update
End With
'Debug.Print fd.Name & " : " & Len(fd.Value)
CC = CC + Len(fd.Value)
Next fd
rs.MoveNext
Loop
Set rs = Nothing
Set rs1 = Nothing