Function SpreadData()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim tdf As DAO.TableDef
Dim tdf2 As DAO.TableDef
Dim i As Integer, j As Integer, k As Integer
Set dbs = CurrentDb()
Set tdf = dbs.TableDefs("MainData")
Set rst = tdf.OpenRecordset
k = rst.RecordCount
If k / 5 Mod 5 <> 0 Then
k = k / 5 + (5 - k / 5 Mod 5) 'round k to the next multiple of 5
Else
k = k / 5
End If
For i = 1 To 5
Set tdf2 = dbs.TableDefs("Table" & i)
Set rst2 = tdf2.OpenRecordset
For j = 1 To k
rst2.AddNew
rst2!valueid = rst!valueid
rst2.Update
rst.MoveNext
Next j
Next i
End Function
Function SpreadData()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim rst2 As DAO.Recordset
Dim tdf As DAO.TableDef
Dim tdf2 As DAO.TableDef
Dim i As Integer, j As Integer, k As Integer, m As Integer
Set dbs = CurrentDb()
Set tdf = dbs.TableDefs("MainData")
Set rst = tdf.OpenRecordset
k = rst.RecordCount
If k Mod 5 <> 0 Then
m = k Mod 5
k = k \ 5 + 1 'round up to cover all records
Else
k = k / 5
End If
For i = 1 To 5
Set tdf2 = dbs.TableDefs("Table" & i)
Set rst2 = tdf2.OpenRecordset
If i < 5 Then
For j = 1 To k
rst2.AddNew
rst2!valueid = rst!valueid
rst2.Update
rst.MoveNext
Next j
Else
For j = 1 To k - (5 - m)
rst2.AddNew
rst2!valueid = rst!valueid
rst2.Update
rst.MoveNext
Next j
End If
Next i
rst.Close
rst2.Close
End Function