SyntaxSocialist
Registered User.
- Local time
- Today, 01:02
- Joined
- Apr 18, 2013
- Messages
- 109
I have a form (frmEdit)
On that form is a subform (subMain)
On that subform is a footer, and in that footer is a textbox (txtCounter) whose control source is: =Count(*)
On frmEdit I have placed a textbox (txtCounterDisplay). I have created a subroutine (Private Sub CountRecords()) to control the value displayed in txtCounterDisplay:
Problem: No matter what I try, txtCounterDisplay will only display "1/" at first. All I have to do to get it to display properly (e.g.: "1/1096") is change the current record of the form using some navigation buttons I have set up, whose associated click events are outlined below. It seems to me that txtCounterDisplay isn't displaying properly at first because txtCounter (in subMain) hasn't finished counting all the records. So how do I update txtCounterDisplay after that initial counting for txtCounter is complete?
On that form is a subform (subMain)
On that subform is a footer, and in that footer is a textbox (txtCounter) whose control source is: =Count(*)
On frmEdit I have placed a textbox (txtCounterDisplay). I have created a subroutine (Private Sub CountRecords()) to control the value displayed in txtCounterDisplay:
Code:
Private Sub CountRecords()
Me.txtCounterDisplay.Value = Me.CurrentRecord & "/" & [subMain].Form.[txtCounter]
End Sub
Problem: No matter what I try, txtCounterDisplay will only display "1/" at first. All I have to do to get it to display properly (e.g.: "1/1096") is change the current record of the form using some navigation buttons I have set up, whose associated click events are outlined below. It seems to me that txtCounterDisplay isn't displaying properly at first because txtCounter (in subMain) hasn't finished counting all the records. So how do I update txtCounterDisplay after that initial counting for txtCounter is complete?
Code:
Private Sub btn1st_Click()
DoCmd.GoToRecord Record:=acFirst
End Sub
Private Sub btnPrev_Click()
DoCmd.GoToRecord Record:=acPrevious
End Sub
Private Sub btnNext_Click()
DoCmd.GoToRecord Record:=acNext
End Sub
Private Sub btnLast_Click()
DoCmd.GoToRecord Record:=acLast
End Sub