C
Carl Rapson
I have a form that contains a subform (subform1), and I am wanting to
perform some actions in subform1's Load event, based on whether or not there
are any records:
Private Sub Form_Load()
If Me.Recordset.RecordCount > 0 Then
...<do some things here>
Else
...<do some different things here>
End If
End Sub
The problem is, the RecordCount is coming back zero, even when there are
records in the Recordset (I know this because the records display in the
subform after it opens). After some investigation, I found that subform1's
Load event is firing before the main form's Load event, when I assume means
that there are not yet any linked records to be displayed in the subform
(and thus the RecordCount is zero). Am I correct in this?
What's really odd is that subform1 itself contains another subform
(subform2); I am doing the exact same thing in subform2's Load event, and it
works properly (the RecordCount returns the proper number of records). I
checked, and the order of the Load events is: subform1, then main form, then
subform2. So by subform2's Load event, apparently the records have been
loaded and all is well. Is there any rhyme or reason to the order of the
Load events? Is there any way to "force" the main form's Load event to
execute before the subform? Otherwise, what would be a good way to
accomplish what I am wanting?
Thanks for any assistance,
Carl Rapson
perform some actions in subform1's Load event, based on whether or not there
are any records:
Private Sub Form_Load()
If Me.Recordset.RecordCount > 0 Then
...<do some things here>
Else
...<do some different things here>
End If
End Sub
The problem is, the RecordCount is coming back zero, even when there are
records in the Recordset (I know this because the records display in the
subform after it opens). After some investigation, I found that subform1's
Load event is firing before the main form's Load event, when I assume means
that there are not yet any linked records to be displayed in the subform
(and thus the RecordCount is zero). Am I correct in this?
What's really odd is that subform1 itself contains another subform
(subform2); I am doing the exact same thing in subform2's Load event, and it
works properly (the RecordCount returns the proper number of records). I
checked, and the order of the Load events is: subform1, then main form, then
subform2. So by subform2's Load event, apparently the records have been
loaded and all is well. Is there any rhyme or reason to the order of the
Load events? Is there any way to "force" the main form's Load event to
execute before the subform? Otherwise, what would be a good way to
accomplish what I am wanting?
Thanks for any assistance,
Carl Rapson