Requery on Subform resets recordset

stormin_norm

Registered User.
Local time
Today, 08:00
Joined
Apr 23, 2003
Messages
213
How can I get a continuous subform to stay on the current record?

When my afterupdate code runs a Requery on a field on a main form, the cursor moves to the next field on the subform but jumps to the first record in the recordset. The requery is resetting the subforms recordset.
As an example...the subform shows recs 1..5, after you change the value of rec3 you are now pointing to rec1. I want to stay on rec3.

I have a subform with the following code:
Private Sub ENG_hours_AfterUpdate()
On Error....
DoCmd.RunCommand acCmdSaveRecord
Me.Parent.ENGtotal.Requery
End
 
Private Sub Address_AfterUpdate()
If Me.Dirty Then
Dim rs As String
Dim Rs1 As String
rs = Forms!MainForm!CustomerID
Rs1 = Me.AddressID

DoCmd.RunCommand acCmdSaveRecord
Forms!MainForm.Requery
Forms!MainForm!CustomerID.SetFocus
DoCmd.FindRecord rs
Forms!MainForm![ subform].SetFocus
[AddressID].SetFocus
DoCmd.FindRecord Rs1
[Number].SetFocus
Me.Repaint
Else
Exit Sub
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom