Making cursor go back to the record I came from?

Compressor

Registered User.
Local time
Today, 03:20
Joined
Sep 23, 2006
Messages
118
I have a subform (continuous) which shows a summary of all clients basic data in a list. Clicking a client requerys and refreshes some other subforms so the accompanying data for that client is shown. Whenever I double click a record, the "main" window for that "object" opens. So say I double click on client A1 in the summary list, a form opens where I can view all the clients data and change it if necessary. That same form is also used to add clients to the database.

Whenever I change or add a clients data and close the form, the following code is executed:

Code:
Private Sub Form_Close()
On Error GoTo ClientsAdd_Err

    Forms![ClientsMain]![ClientsViewSummarySubForm].Form.Requery
    Forms!ClientsMain.Refresh
    
ClientsAdd_Exit:
    Exit Sub

ClientsAdd_Err:
    MsgBox Error$
    Resume ClientsAdd_Exit
End Sub

Which makes the new client appear in the summary list or makes the changed data of an existing client appear in the summary list. That's what I want it to do of course.

But whenever that is done, the cursor jumps back to the first record (client 1) in the summary list. What I would like to have happen is:

- when a new client has been added, keep the cursor on that client in the summary list after the form closes and the list is updated.

- when a record of an already existing client is changed and the form closes, keep the cursor on that client in the list also.

DoCmd.GoToRecord acForm, "ClientsViewSummarySubForm", acLast
gives "The object ClientsViewSummarySubForm isn't open. As does the same line of code but then using the name "ClientsViewSummary". The form itself is called that way. The subform object itself goes by: "ClientsViewSummarySubForm".

I've tried some variations but all without succes.
Which line of code is the correct one to use for a subform on a parentform instead of "just" a normal, open form?
 
Have a look at my post here, the code in this sample should do what you want.
 
Hahaha.... I'm such a newbie... Can't make heads or tails of it. Well... at least one of them is missing ;)

Well, as far as I can tell I need to take a crashcourse on the Bookmark function. So as soon as I've recovered from the crash of this afternoon I will start and do that.

Thanks!
 

Users who are viewing this thread

Back
Top Bottom