I believe it should be something like this:
Set rs = db.OpenRecordset(WorkTbl)
rs.MoveLast 'RecordCount is updated after moving to the last record
iRecCount = Rs.RecordCount
Rs.MoveFirst ' start at the top
For x = 1 to iRecCount
With Rs
If .Group = "PQ" Or .Group = "VPQ" Then
.W2KAcct = True
.FPAcct = True
ElseIf .Group = "CS" Then
.W2KAcct = True
.FPAcct = True
.WrkGrpEml = True
.RCIAcct = True
End If
.MoveNext 'Move to next record and loop
End With
Next x
mike.wilson8@comcast.net (Mike Wilson) wrote in message news:<e283d477.0311242110.5a2d0b44@posting.google. com>...[color=blue]
> I'm trying to get a loop going based on my VB code below in Access.
> I've tested the code by selecting an individual record set and
> clicking the command 5 button. It works. Now instead of clicking on
> each individual record set, I want to loop through all the records in
> my table.
>
> Fields - W2KAcct, FPAcct, RCIAcct, WrkGrpEml are all Yes/No boxes.
> Basically,
> if a group = PQ or CS, then certain boxes like W2KAcct or FPAcct get
> checked.
>
> Private Sub Command5_Click()
>
> If [WorkTbl]![Group] = "PQ" Or [WorkTbl]![Group] = "VPQ" Then
> [WorkTbl]![W2KAcct] = True
> [WorkTbl]![FPAcct] = True
>
> ElseIf [WorkTbl]![Group] = "CS" Then
> [WorkTbl]![W2KAcct] = True
> [WorkTbl]![FPAcct] = True
> [WorkTbl]![WrkGrpEml] = True
> [WorkTbl]![RCIAcct] = True
> End If
> End Sub[/color]