Subform index

  • Thread starter Thread starter Gus Chuch
  • Start date Start date
G

Gus Chuch

I have a form with a subform on it and it’s link to a combo box for
locations, when I pick a new location name from my combo box the subform
index pointer stays in the last place it was at. I would like to set the
index on the subform to go to the first record when a new name is picked. I
got the tab order OK I just would like to some how set the index to the first
record after update on the combo box.
Any ideas
 
Gus Chuch said:
I have a form with a subform on it and it's link to a combo box for
locations, when I pick a new location name from my combo box the subform
index pointer stays in the last place it was at. I would like to set the
index on the subform to go to the first record when a new name is picked.
I
got the tab order OK I just would like to some how set the index to the
first
record after update on the combo box.
Any ideas

With Me.ComboName
.Value = .ItemData(0)
End With
 
That’s not really what I’m looking for. That set’s the combo box index to 0.
I’m after the subform index to be set to 0.
 
That’s not really what I’m looking for. That set’s the combo box index to 0.
I’m after the subform index to be set to 0.

Subforms don't have an "Index" property. If you want the subform to display
the first record, use some appropriate event to execute code like:

Private Sub eventname()
DoCmd.GoToRecord,,acFirst
End Sub

John W. Vinson [MVP]
 
do I have to use an objectname for the subform? if so how would i do it?

GoToRecord defaults to the current form. I haven't tried it recently but I
think it should work - if not post back.

John W. Vinson [MVP]
 
I used the DoCmd.GoToRecord,,acFirst with no luck. I also used the wizard
with a command button but had no luck either. I’m looking in my VBA handbook
and if you omit the objecttype and objectname argument the active object is
assumed. The form would be the active object not the subform, right??
 
F.Y.I
I put the DoCmd.GoToRecord,,acFirst in the Form Activate Event
Private Sub Form_Activate()
DoCmd.GoToRecord , , acFirst
End Sub
works great
 
Back
Top