Happy Sunday:
- I'd like to set a **subform's** control "Navigation Buttons" = "No".
- At the same time, I still would like to see the number of records (from that subform) in an unbound textbox on the **mainform**.
- For testing purposes only, I added the following on the current event in the main form.
Code:
Private Sub Form_Current()
MsgBox DCount("ID", "Query1", "ID=" & Me.ID), vbInformation, "Count of Records in Subform"
End Sub
- The pop-up message boxes display the correct number of records from the subform when navigating through the 9 main records.
- However, I would like to remove the msgbox and replace the record with the code listed below.
Code:
Private Sub Form_Current()
Dim CountID As Integer
Me.CountID = DCount("ID", "Query1", "ID=" & Me.ID)
End Sub
- Unfortunately, when replacing the msgbox with the 2 lines above, I get a run-time error "You can't assign value to this object."
What is missing/incorrect in the VBA so that I can display the subform's record counts of {8, 7, 5, 4, 7, 3, 5, 8, 10} on the mainform's **green** unbound text box [CountID] when navigating through the 9 records.?
Thanks in advance.