Custom Navigation Buttons - Update Total # of Records?

wrek

Registered User.
Local time
Today, 09:08
Joined
Jun 14, 2001
Messages
88
Hey ya,

Take a look at the attachment first. Ok, now here's my problem:

I've got some custom navigation buttons on both my main form, a subform, and a sub-subform...(nested 3 levels deep)

They work. Except that the "y" of the "x of y" record count, for example, does not get refreshed for the subforms when I change the main record.

I want the subforms to recalculate the RecordCount for each of their Recordsets (dynamically) each time the record changes.

For the OnCurrent event for each form, I use the following code:

Dim rstForm As Recordset
Set rstForm = Me.RecordsetClone
rstForm.Bookmark = Me.Bookmark
lngGetRecCount = rstForm.RecordCount

where lngGetRecCount is the "y"

[If I go down to the subforms and 'activate' them, eg. filter and then remove filter, the RecordCount gets updated accurately]

Any ideas? Thanks.
 

Attachments

  • navbut3.jpg
    navbut3.jpg
    89 KB · Views: 295
Last edited:
Pat Hartman said:
I dont' have an answer but I do have a retorical question for you. Why are you writing code to handle things that Access handles perfectly fine? Do you have too much time on your hands? Are you being paid by the hour, line of code? Are you a frustrated VB or C++ programmer and miss all that extra work of coding for unbound forms?

No, those are just my dreams: Being paid by line of code and having too much time on my hands. :D

I wanted to customize the nav. buttons, so I could put descriptive titles in each nav bar as opposed to 'Record'...I couldn't figure out another way to change the Caption.

Also this way, I can choose the location of my nav bar...

Is there an easier way you can suggest?
 
Does this work
Me.txtCurrRec = Form.CurrentRecord
Me.txtTotalRecs = Form.RecordsetClone.RecordCount + IIf(Form.NewRecord, 1, 0) & " " & "(filtered)"
 
The .RecordCount element of the code seems to be working...the problem is, I can't/don'tknowhowto 'requery' it to recalculate the TotalRecs every time the record on the main form changes....

MainForm (DCPs) has nested subform (DCNs) which has nested subform (Docs). You see, one DCP, can have 15 DCNs, the next can have 8 etc
and likewise each DCN can have a different number of docs.

I currently have the Me.RecordsetClone.RecordCount running on the OnCurrent for each form/subform....but OnCurrent for the subforms isnt reached when flipping through records on the mainform.
 
anyone?

to sum it up, I need to simulate my subform's OnCurrent Event procedure...

which calls this function to set the Total # of Records:

Private Function lngGetRecCount() As Long
Dim rstForm As Recordset
Set rstForm = Me.RecordsetClone
On Error Resume Next
rstForm.Bookmark = Me.Bookmark

lngGetRecCount = rstForm.RecordCount
End Function
 

Users who are viewing this thread

Back
Top Bottom