I am working with Microsoft Access 2000. The porblem I am expericing is with a subform. I am trying to use the gotorecord method to move to the next record in the subform. When I run the code I get a message stating that the object is not open. The event is triggerd by a button on the sub form. How do I use the gotorecord method on a subform.
Microsoft Access
Last Comment
harfang
8/22/2022 - Mon
harfang
GoToRecord works either on a named object or on the current object (default parameter acActiveDataObject). Since a subform has no name, this is your only choice. Make sure the subform is active (i.e. the main form is active and the subform has the focus this isn't a problem as the button *is* on the subform) and use:
DoCmd.GoToRecord Record:=acGoTo, Offset:=108
To go to the last, first, etc, you also have RunCommand acCmdRecordsGoTo???
Finally, you can also use the recordset object of the subform:
DoCmd.GoToRecord Record:=acGoTo, Offset:=108
To go to the last, first, etc, you also have RunCommand acCmdRecordsGoTo???
Finally, you can also use the recordset object of the subform:
Me.subFormControlName.Form
(because .AbsolutePosition is 0-based), or more to the point, as this is run *from* the subform:
Me.Recordset.AbsolutePosit
Cheers!
(°v°)