custom record countor subform

Siegfried

Registered User.
Local time
Today, 05:23
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.
 
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
 
Works perfectly, thanks!
 

Users who are viewing this thread

Back
Top Bottom