Event after data is populated

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to put my own navigation buttons on my form and enable / disable the
previous and next record buttons if the user is already at either end of the
recordset. I have everything working correctly except for the initial record
that is shown when the form opens. I have the following code in Form_Current:

rcdCount = Me.Recordset.RecordCount
If Me.CurrentRecord = rcdCount Then _
Me.NextButt.Enabled = False Else Me.NextButt.Enabled = True
If Me.CurrentRecord = 1 Then _
Me.PreviousButt.Enabled = False Else Me.PreviousButt.Enabled = True

The problem I have is that the RecordCount is 1 when the form loads. I am
assuming that Access loads the form and only the first record, then the
remaining records after the form is loaded. Am I correct with this
assumption? Is there any other event that is triggered once all the
underlying records are loaded?
 
AdmSteck said:
I want to put my own navigation buttons on my form and enable / disable the
previous and next record buttons if the user is already at either end of the
recordset. I have everything working correctly except for the initial record
that is shown when the form opens. I have the following code in Form_Current:

rcdCount = Me.Recordset.RecordCount
If Me.CurrentRecord = rcdCount Then _
Me.NextButt.Enabled = False Else Me.NextButt.Enabled = True
If Me.CurrentRecord = 1 Then _
Me.PreviousButt.Enabled = False Else Me.PreviousButt.Enabled = True

The problem I have is that the RecordCount is 1 when the form loads. I am
assuming that Access loads the form and only the first record, then the
remaining records after the form is loaded. Am I correct with this
assumption? Is there any other event that is triggered once all the
underlying records are loaded?


Loading all but the initial set of records in a form is a
background activity that Access performs as time permits
from other more important(?) activities. There is no event
when this background actitvity completes. Actually, I've
seen cases where it doesn't seem to ever complete unless the
user scrolls/navigates the form to a record near(?) the end
of the recordset.

You can force Access to "load" all the records by using a
line of code in an appropriate event procedure (the Load
event is the earliest that can do this):

With Me.RecordsetClone
.MoveLast
End With
 
Thank you very much... works like a charm!

Marshall Barton said:
Loading all but the initial set of records in a form is a
background activity that Access performs as time permits
from other more important(?) activities. There is no event
when this background actitvity completes. Actually, I've
seen cases where it doesn't seem to ever complete unless the
user scrolls/navigates the form to a record near(?) the end
of the recordset.

You can force Access to "load" all the records by using a
line of code in an appropriate event procedure (the Load
event is the earliest that can do this):

With Me.RecordsetClone
.MoveLast
End With
 
Back
Top