View Full Version : Go to a specific record in a subform


JCollins
12-03-2001, 08:29 AM
I have a parent form that filters a subform. When I change a cbobox on the parent form, I want the subform to refresh and go to the first record....

I have been trying to use the gotorecord action behind the OnChange event of the cbobox on the parent form, but it is not working...Any thoughts

Rich
12-03-2001, 09:33 AM
Do you mean set focus to the first field in the subform?

JCollins
12-03-2001, 10:29 AM
Yes, I want to set focus on the first record.

Rich
12-03-2001, 10:48 AM
SomeFormName.SetFocus
Forms!SomeFormName!SubFormName.Form!FieldName.SetF ocus should work other than that DoCmd. GoToControl, SubFormName
DoCmd. GoToControl, FieldName
you might find it easier to use the maco builder and then convert it to vb

JCollins
12-03-2001, 11:10 AM
Thanks Rich!

This worked PERFRECTLY!

dim ctl as Control

set ctl =......subform name

DoCmd.GoToControl ctl.Name
DoCmd.GoToRecord , , acFirst