Cursor always jumps back to first record !

StefanSch

Registered User.
Local time
Today, 16:11
Joined
Jan 18, 2003
Messages
136
Hello

I have the "subform B" in the "mainform A". When users work in the "subform B" (e.g. entering or changing data), the cursor always goes back to the first record of "Subform B" after every amendment of data.

why is that?

Stefan
 
Do you have any code in the AfterUpdate, OnCurrent, OnChange etc events of either the controls or the form which are forcing the cursor to move?

If you tab out of a changed record, does it still return to the first record?

if a small db, pls post(A97 version pls)
 
Sounds like you are doing a Refresh or Requery. Either of which will reposition you to the first record of a recordset. If you are doing one of those things in an attempt to save the current record, change your code to do it the correct way:

DoCmd.RunCommand acCmdSaveRecord
 
Thank you both. I'll give the "CmdSaveRecord" a try.

Stefan
 
Hello

I tried your code. It partly works. However, since the save command does no "recalc" the whole screen, my previous coding is not working well.

How can I achieve the recalc function (after update event) without jumping back to the first record ?

Regards,

Stefan
 
Private Sub Address_AfterUpdate()
Dim rs As String

rs = Forms!Customers!CustomerID

DoCmd.RunCommand acCmdSaveRecord
Forms!Customers.Requery
Forms!Customers!CustomerID.SetFocus
DoCmd.FindRecord rs
Me.Number.SetFocus

End Sub


on second thoughts and coffee I suspect you want to return to the record on the subform where Address is the last entry field on the subform

Private Sub Address_AfterUpdate()
Dim rs As String

rs = Forms!Customers!CustomerID

DoCmd.RunCommand acCmdSaveRecord
Forms!Customers.Requery
Forms!Customers!CustomerID.SetFocus
DoCmd.FindRecord rs
Forms!MyMainForm!MySubForm.SetFocus
DoCmd.GoToRecord,,acLast

End Sub
 
Last edited:
Thanks. I think that this is what I have been looking for.


Stefan
 

Users who are viewing this thread

Back
Top Bottom