I'll try in brief, using an order-entry analogy:
frmEncounter is used for entering orders. Each order has several products. I
wanted to be able to see the previous orders in the same window I am using to
enter new orders, so I created the subfrmCaseHistory. This form is a
continuous form based on a query that shows all orders listed
chronologically, but each order with only one of the products (the most
expensive product in the order). To make it more useful, when the
subfrmCaseHistory opens it uses GoToRecord,, acLast to automatically scroll
to the bottom of the list so that most recent orders are shown.
When I enter a new order, I want subfrmCaseHistory to show the new order at
the bottom of the list. So I want to execute a requery for the form and redo
the DoCmd.GoToRecord,,acLast. I can get the execute the requery, but the
GoToRecord gives me the error.
Jeanette Cunningham said:
Do you want the subform to show the newly added record after the subform is
requeried?
Perhaps best if you explain the scenario - what are you doing to the forms
that makes a requery of the subform necessary?
We can recommend something appropriate for the situation.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
CuriousMark said:
OK...figured out the problem.
The statement that is giving me the problem is:
DoCmd.GoToRecord acDataForm, "CaseHistory", acLast
(notice, I removed the space). This gives me the object is not open error.
Jeanette Cunningham said:
Hi CuriousMark,
check carefully for the correct name for the subform control. If that
doesn't work try this long shot. Make sure that the code to requery the
subform is on the main form that actually has this subform.
I was once caught by this type of thing, I had put the requery code on
the
wrong form and spent time trying to debug it - took quite a while to
realise
that I had the code on the wrong form - that's what late nights spent
coding
can do to you.
Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
I've looked throught discussion groups, and can't find the solution:
I have a main form (frmEncounter) with a subform. The subform control's
name
is "Case History" and its source object is "subfrmCaseHistory".
subfrmCaseHistory is based on a simple query. I have tried writing code
in
the main form module to requery the subform and refresh the data:
Me![Case History].Form.Requery
Me.[Case History].Requery
but I get this error:
2489: The object 'Case History' isn't open
What's wrong?
Thanks