find a records position

  • Thread starter Thread starter Tim J
  • Start date Start date
T

Tim J

I would like to find the position of a record on a form
according to how the records are sorted on the form.

So, For example, I have Three records

ID FruitType

1 Orange
2 Apple
3 Pear

Sorted on a form ascending by fruittype.

I need to find that 1 Orange is listed second on the form.

I only need to find the position of the current record if
that makes things easier.

TIA,
Tim J
 
Tim said:
I would like to find the position of a record on a form
according to how the records are sorted on the form.

So, For example, I have Three records

ID FruitType

1 Orange
2 Apple
3 Pear

Sorted on a form ascending by fruittype.

I need to find that 1 Orange is listed second on the form.

I only need to find the position of the current record if
that makes things easier.


Check Help on the Form's CurrentRecord property.

If you do not want to change the current record, you can use
the RecordsetClone's AbsolutePosition property:

With Me.RecordsetClone
.FindFirst "FruitType='Orange' "
If Not .NoMatch Then
position = .AbsolutePosition
End If
End With
position
 
Back
Top