G
Guest
Can someone indicate what is wrong with my first attempt to write a For loop
as follows:
Private Sub UpdateAll_Click()
Dim myform As Form
Dim frmRst As DAO.Recordset
Dim r As Integer
Dim c As Integer
Dim i As Integer
Set myform = Me.GroupMembers.Form
Set frmRst = Me.GroupMembers.Form.RecordsetClone
r = frmRst.RecordCount
For c = 0 To r - 1
For i = 1 To 23
If Me("Dat" & i) <> 0 Then
Forms!ContactProfile!GroupHead!GroupMembers.Form! _
("Cont" & i) = Me("Dat" & i)
End If
Next i
Next c
End Sub
The code updates the first record; but moves through any remaining records
without updating any data.
as follows:
Private Sub UpdateAll_Click()
Dim myform As Form
Dim frmRst As DAO.Recordset
Dim r As Integer
Dim c As Integer
Dim i As Integer
Set myform = Me.GroupMembers.Form
Set frmRst = Me.GroupMembers.Form.RecordsetClone
r = frmRst.RecordCount
For c = 0 To r - 1
For i = 1 To 23
If Me("Dat" & i) <> 0 Then
Forms!ContactProfile!GroupHead!GroupMembers.Form! _
("Cont" & i) = Me("Dat" & i)
End If
Next i
Next c
End Sub
The code updates the first record; but moves through any remaining records
without updating any data.