From: IanP on
Hi,

I have a form consisting of 3 tabbed pages. The 1st tab contains the main
form with 2 sub forms on a the other tabs. I am trying to display the record
number on all of forms but do not want to use the record navigation buttons.

I have used the following code in the On Current event of all 3 forms to do
this;

If Me.NewRecord Then
Me!lblTotal.Caption = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!lblTotal.Caption = "Record " & _
.AbsolutePosition + 1 _
& " of " & .RecordCount
End With
End If

This works fine on the main form but not on the subforms. When you move to
the subform tabs the label always displays "Record 1 of 1" until you start
scrolling through the records after which correct record number is shown. I
realise this is because the event runs in the On current event of the subform
but need the code to run everytime the tab onto the subform is clicked.

Any ideas how to do this?

Thanks for your time

From: KateB on
Hi Ian,

I was looking for something similar earlier this week and found a link to
this:

http://www.lebans.com/rownumber.htm

I am self-taught and managed to get it to work (thanks Stephen Lebans you're
a star!) Not sure if its exactly what you want, but might be of help.

Kate

"IanP" wrote:

> Hi,
>
> I have a form consisting of 3 tabbed pages. The 1st tab contains the main
> form with 2 sub forms on a the other tabs. I am trying to display the record
> number on all of forms but do not want to use the record navigation buttons.
>
> I have used the following code in the On Current event of all 3 forms to do
> this;
>
> If Me.NewRecord Then
> Me!lblTotal.Caption = "New Record"
> Else
> With Me.RecordsetClone
> .Bookmark = Me.Bookmark
> Me!lblTotal.Caption = "Record " & _
> .AbsolutePosition + 1 _
> & " of " & .RecordCount
> End With
> End If
>
> This works fine on the main form but not on the subforms. When you move to
> the subform tabs the label always displays "Record 1 of 1" until you start
> scrolling through the records after which correct record number is shown. I
> realise this is because the event runs in the On current event of the subform
> but need the code to run everytime the tab onto the subform is clicked.
>
> Any ideas how to do this?
>
> Thanks for your time
>
> .
>