Compressor
Registered User.
- Local time
- Today, 06:28
- 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:
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.
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?
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.
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".DoCmd.GoToRecord acForm, "ClientsViewSummarySubForm", acLast
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?