By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,238 Members | 1,565 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,238 IT Pros & Developers. It's quick & easy.

Selecting the first record of a subform in datasheet view?

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
> 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
--
Peace & happy computing,

Mike Labosh, MCSD
"I have no choice but to believe in free will."
Nov 13 '05 #2

P: n/a
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.

Nov 13 '05 #3

P: n/a
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.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.