F
Fysh
About a week ago I posted and was given a good response on
how to use up and down arrows to allow someone to change
the order of training requirements. This portion works
great, but now I have to figure a way to reset the order
back to the original position in case someone wants to be
able to do this. Here is the code that I have for
changing the ordering. By chance does someone know how to
go back and loop the table and reset each order number in
order of the id number? Any thoughts would be appreciated.
Private Sub AttUp_Click()
Dim lngOrdNum As Long
With Me.frmAnomalySubform.Form.RecordsetClone
.Bookmark = Me.frmAnomalySubform.Form.Bookmark
If .AbsolutePosition < .RecordCount Then
.Edit
lngOrdNum = !Ordering - 1
!Ordering = lngOrdNum
.Update
.MovePrevious
.Edit
!Ordering = !Ordering + 1
.Update
Forms!frmSection!frmAnomalySubform.Requery
.FindFirst "Ordering = " & lngOrdNum
Me.frmAnomalySubform.Form.Bookmark = .Bookmark
Else
Beep
End If
End With
End Sub
The table is:
ANOMALYID AutoNumber
Anomaly Text
CATID Number FK
Ordering Number
Etc.
how to use up and down arrows to allow someone to change
the order of training requirements. This portion works
great, but now I have to figure a way to reset the order
back to the original position in case someone wants to be
able to do this. Here is the code that I have for
changing the ordering. By chance does someone know how to
go back and loop the table and reset each order number in
order of the id number? Any thoughts would be appreciated.
Private Sub AttUp_Click()
Dim lngOrdNum As Long
With Me.frmAnomalySubform.Form.RecordsetClone
.Bookmark = Me.frmAnomalySubform.Form.Bookmark
If .AbsolutePosition < .RecordCount Then
.Edit
lngOrdNum = !Ordering - 1
!Ordering = lngOrdNum
.Update
.MovePrevious
.Edit
!Ordering = !Ordering + 1
.Update
Forms!frmSection!frmAnomalySubform.Requery
.FindFirst "Ordering = " & lngOrdNum
Me.frmAnomalySubform.Form.Bookmark = .Bookmark
Else
Beep
End If
End With
End Sub
The table is:
ANOMALYID AutoNumber
Anomaly Text
CATID Number FK
Ordering Number
Etc.