472,101 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,101 software developers and data experts.

Display record number of record count in a subform

I have a main form with navigation buttons on it and a label showing
for example Record 1 of 15 using recordsetclone on it and eveything
works fine. When I move through the records the record number changes
fine. Within this main form I have a subform detailing distribution
records for the contact (main form is based on this) that also has
navigation buttons and a label showing Distribution 1 of ##. This is
where the problem lies. The first main record has two records in its
subform and shows Distribution 1 of 2. When I move to the next record
on the main form, the subform still shows Distribution 1 of 1, when
this record doesn't actually have any sub records. This happens for
all records I scroll until I reach 13 of 15 which actually has a
subrecord and displays Distribution 1 of 1. When I scroll to previous
records each one now shows Distribution 1 of 1 whereby before I
reached this point is showed Distribution 1 of 2. When I get back to
Record 1 of 15 on the main form the subform label shows Distribution 1
of 2 again and repeats this for each until record 13 of 15 is reached
again. It doesn't seem to update or calculate how many records this
subform is showing and just repeats through the records until a record
actually has data in it.

Can I just add that the subform is showing the correct records it's
just that the label I have used to display the Distribution # of ## is
not updating properly when using the naviagtion buttons.

The subform is based on a table called tblDistribution which records
how many publication distributions a Contact has had. The contact is
the main form/table. As it stands the tblDistribution has 3 records
in it and as I stated above the label is not displaying the amount
each person has correctly.

I need the subform to kind of look at the current contact and
calculate how many distributions they have had and that should be the
value used in the label, but using the clone doesn't seem to do this.

Any help would be greatly appreciated. Thanks in Advance. Carl J

Here is a snip of the code I am using. I haven't included any of the
navigation areas as these work OK.

Dim recClone As Recordset
Dim intTotalRecords As Integer
Dim intCurrentRecord As Integer

'Make a clone of the recordset underlying the form so
'we can move around that without affecting the form's
'recordset. This clones tblDistribution which currently
'has 3 in it.

Set recClone = Me.RecordsetClone()

'move to the last record in the recordset

'synchronize the form's and recordset's bookmarks
recClone.Bookmark = Me.Bookmark

'set the intCurrentRecord var. Because recordsets are zero based, add
1 to the value
intCurrentRecord = recClone.AbsolutePosition + 1

'set intTotalRecords var
intTotalRecords = recClone.RecordCount

'set RecordDetails caption
lblDistributionDetails.Caption = "Distribution: " & intCurrentRecord &
" of " & intTotalRecords

'And finally close the cloned recordset
Nov 12 '05 #1
0 8036

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by DS | last post: by
11 posts views Thread by bala | last post: by
17 posts views Thread by perryche | last post: by
1 post views Thread by Nick via AccessMonster.com | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.