Selecting the first record of a subform in datasheet view?

  • Thread starter Thread starter kevin.jonas
  • Start date Start date
K

kevin.jonas

What is the line of code to select the first record of a subform? I
have a form with two subforms. What you select in one subform controls
what is queried in the second subform. however when the form starts a
record isn't selected and the second subform shows all data.

Kevin
 
What is the line of code to select the first record of a subform? I
have a form with two subforms. What you select in one subform controls
what is queried in the second subform. however when the form starts a
record isn't selected and the second subform shows all data.

Inside the Load event of the subform, you could do this:

Me.Recordset.MoveFirst
 
I already tried that. It selects the first field but doesn't fire the
On Current event. So I called the On Current Event from the Form Load
and it still doesn't update the second subform until I physically
select a different record in the first subform.
 
I sorta figured it out, used the wrong form load function. I needed to
use the main form's form load, not the subforms.
Reading MS's docs a form automatically selects the first record when it
loads. So movefirst doesn't do anything since it is already at the
first record. I needed to also set the recordsource for the second
subform int he main form's load form. I also set the subform to the
same query in the first subform's on current event. It all works.
 
Back
Top