OK .... I think I have a solution for a "move to top" command.
But the code errors on the line
Code:
intNeedPunching = DCount("[FabID]", "[tblFabrication]", "[NeedPunching] =True AND [Completed] =False AND [PunchingSort] <CurrentPos")
FabID is the unique field in the table tblFabrication. The table has all 3 of the fields NeedPunching, Completed, and PunchingSort.
CurrentPos is the variable that holds the value of PunchingSort before it gets changed.
The Full Code
Code:
Private Sub Command542_Click()
If Me!PunchingSort <= 1 Then
MsgBox "This record cannot move up"
Exit Sub
End If
Dim CurrentPos As Integer
Dim NewPos As Integer
Dim intNeedPunching As Integer
CurrentPos = Me!PunchingSort
NewPos = 1
intNeedPunching = DCount("[FabID]", "[tblFabrication]", "[NeedPunching] =True AND [Completed] =False AND [PunchingSort] <CurrentPos")
Me!PunchingSort = NewPos
For Index = 1 To intNeedPunching
DoCmd.GoToRecord , , acPrevious
Me!PunchingSort = Me!PunchingSort + 1
Next
Me.Requery
Me.PunchingSort.SetFocus
DoCmd.FindRecord NewPos
End Sub