How to make a subform display information correctly

J

John Doe

I have the following inserted into the OnCurrent event on a subform:

'This places the "Record X of Y" into txtNavigate text box.
If Me.NewRecord Then
Me!txtNavigate = "New Record"
Else
With Me.RecordsetClone
.Bookmark = Me.Bookmark
Me!txtNavigate = "Record " & .AbsolutePosition + 1 & _
" of " & .RecordCount
End With
End If

This works fine when I place it on a parent form.

When I place it in the Subform and I go to a parent record it
initially just displays the following (in the subform):

Record 1 of 1

even if there are more child records. If I click on the Next Record
button on the subform, then it correctly displays the following:

Record 2 of 5

How can I get the display to show and count correctly when the form
loads and when going to a new parent record?

I tried putting Me.Requery in the OnCurrent event of the subform, but
then it took about 5 seconds to move to each new record, so something
bad happened there.
 

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