move to next record of a subform on a tabbed form

Ruzz2k

Registered User.
Local time
Today, 18:51
Joined
Apr 28, 2012
Messages
102
hi i would like to move to next record of a subform on a tabbed form from a different tabbed form. I have the following which works but i was after something that was not physically moving back and forth on the forms.

Private Sub next4_Click()
'Next Record
On Error GoTo Err_next4_Click
Forms![frmDocumentRegister]![TabCtl0] = 0
frmDOC.SetFocus
DoCmd.GoToRecord , , acNext
Forms![frmDocumentRegister]![TabCtl0] = 1
Exit_next4_Click:
Exit Sub
Err_next4_Click:
MsgBox err.Description
Resume Exit_next4_Click
End Sub
 
Hi

A very natural request to avoid the onscreen movement.
Assuming you're using Access 2000 or newer (a safe assumption these days surely ;-) you can access the form's recordset property and accomplish the above with a single line of code.

Me.frmDOC.Form.Recordset.Movenext

Cheers.
 
Thanks works a treat. Now it's not so painful changing records
 

Users who are viewing this thread

Back
Top Bottom