I have the following in a Command Button on a Sub from. When I run it I get no errors and the record set runs. But, even though it looks like the rst is being "moved next", per the msgbox before the move next(AbsolutePosition 0,1,2) of which there are 3 AND the msgbox just inside the "While", the MixItemID (number) stays the same telling me its never moving off the first rst of the strSQL. I've tried several variations with the same result. What am I doing wrong?
Public Sub ReCalcB_Click()
On Error GoTo ErrMsg
Dim dbs As Database
Dim rst As Recordset
Dim strSql As String
Set dbs = CurrentDb()
strSql = "SELECT * FROM [MixItemT]"
strSql = strSql & " WHERE [MixID]=" & Me![MixID] & " AND [MixitemID]> 0" & ";"
Set rst = dbs.OpenRecordset(strSql)
If (rst.EOF) Then
msgbox " There are no items for this mix"
Else
While (Not (rst.EOF))
msgbox "in while Mixid " & MixID & "MixitemID " & MixItemID
'Me.TFocus.SetFocus ' cause JuicePerCent var to be recalculated in each MixItem
msgbox rst.AbsolutePosition & "MixID " & MixID & "MixItemID " & MixItemID
rst.MoveNext
Wend
End If
rst.Close
dbs.Close
Me.Refresh 'refresh subform
Forms!mixingf!MixML = SumMl ' on main form
Exit_ErrMsg:
Exit Sub
ErrMsg:
Resume Exit_ErrMsg
PMMerrormsg (Err)
Resume Exit_ErrMsg
End Sub