custom record countor subform (1 Viewer)

Siegfried

Registered User.
Local time
Today, 01:49
Joined
Sep 11, 2014
Messages
105
Dear Experts,

Appreciate if you could help me out with the VBA code for displaying record count of a subform in a label on the main form.

I found following code to display record count in a label.

Code:
Private Sub Form_Current()
     If Me.NewRecord Then
         Me.lblEvent.Caption = _
          "Events (" & Me.Recordset.RecordCount + 1 & ")"
     Else
         Me.lblEvent.Caption = _
          "Events (" & Me.Recordset.RecordCount & ")"
     End If
End Sub

The label is on my main form (frmMain) which displays as subform frmqryEventsub labeled lblEvent. I want to show this label as Events RecorCount, eg Events 5.

Many thanks.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 07:49
Joined
May 7, 2009
Messages
19,230
Code:
Private Sub Form_Current()
     If Me.NewRecord Then
         Me[COLOR=Blue].Parent[/COLOR]!lblEvent.Caption = _
          "Events (" & Me.Recordset.RecordCount + 1 & ")"
     Else
         Me.[COLOR=Blue]Parent[/COLOR]!lblEvent.Caption = _
          "Events (" & Me.Recordset.RecordCount & ")"
     End If
End Sub
 

Siegfried

Registered User.
Local time
Today, 01:49
Joined
Sep 11, 2014
Messages
105
Works perfectly, thanks!
 

Users who are viewing this thread

Top Bottom