Solved Focus on continuous form (1 Viewer)

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:09
Joined
May 21, 2018
Messages
8,529
Glad it worked. Again, you may want to look at the Emulated Split form. This provides a lot of functionality and less clutter since you do not have another form open.
 

gemma-the-husky

Super Moderator
Staff member
Local time
Today, 11:09
Joined
Sep 12, 2006
Messages
15,656
Generally I thought me.refresh did not requery the underlying data. Me.requery does requery the data, but places the active cursor back to the first record.

So I thought you had to store the current position, requery, and then restore the active cursor to the steed position.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:09
Joined
May 21, 2018
Messages
8,529
Generally I thought me.refresh did not requery the underlying data. Me.requery does requery the data, but places the active cursor back to the first record.

So I thought you had to store the current position, requery, and then restore the active cursor to the steed position.
I believe that was what was suggested
Code:
Public Function PopUpDetails()
  Dim currentID As Long
  currentID = Me.Id  'Save current record id
  'edit record
  DoCmd.OpenForm "frmPopUpDetails", , , "ID = " & currentID, , acDialog
  'requery after edit
  Me.Requery
  'move back to record
  Me.Recordset.FindFirst "ID = " & currentID

End Function

Save record id
edit record
Requery after editing
return to saved record id
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:09
Joined
Feb 19, 2002
Messages
43,275
I think the bit about filters is a red herring.

If you open the popup as a dialog, then code in the calling procedure stops as the popup opens. When the popup closes, control returns to the line after the OpenForm method. That can now be:
Me.Refresh
Which will return the edited value and show it on the subform without requerying which will always move focus back to the first record.

If the popup can add records, then there is a different, more complicated way to solve the problem.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 06:09
Joined
May 21, 2018
Messages
8,529
I think the bit about filters is a red herring
Yes that is why it took 23 posts to figure out what the real question was
If you open the popup as a dialog
The OP is unfortunately not doing this, for what reason I do not know. Instead the OP is keeping a second edit form open with a save button to push the continuous form to update. My suggestion was if you want to see both the edit/detail form and a continuous form at the same time, it is better to combine them using a "split form" approach instead of two open forms. Because the MS split form is crap, I recommend going with the @isladogs emulated split form.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:09
Joined
Feb 19, 2002
Messages
43,275
@MajP Your solution is fine and the OP seems to like it. Merry Christmas.
 

Users who are viewing this thread

Top Bottom