find a records position

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
 
M

Marshall Barton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top