A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Show record numbers on subforms



 
 
Thread Tools Display Modes
  #1  
Old February 18th, 2010, 12:12 PM posted to microsoft.public.access.forms
IanP
external usenet poster
 
Posts: 1
Default Show record numbers on subforms

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

  #2  
Old February 18th, 2010, 01:11 PM posted to microsoft.public.access.forms
KateB
external usenet poster
 
Posts: 75
Default Show record numbers on subforms

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

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:27 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.