I finally had some time to look at this again. And I have a solution that's 80% their. In the embed point for the add button I have the following code :
Access:OrderDetail.Insert()
SQLFile{PROP:SQL} = 'SELECT MAX(OrderDetailID) FROM Ordering.OrderDetail WHERE OrderID = ' & p_web.gsv('Ohr:OrderID')
Next(SQLFile)
Access:OrderDetail.Fetch(Odt:PK_OrderDetail, SQL:F1)
p_web.SetValue('Odt:OrderDetailID', SQL:F1)
p_web.SetSessionValue(name(OrderDetail) & '_FormValue','K' & Position(Odt:PK_OrderDetail))
It finds the record that was just added, and set a session value the same as when a form was saved. This is form my code, not the example I posted, but the idea should be similar.
At the end of the AjaxChildren Routine in the same procedure I added:
p_web.SetValue('_refresh_','saved')
I think this tricks the browse of included items that a new record was saved using a from.
I still have 2 problems
1: The sort order and search are still being reset to default
2: The browse with the add button is still getting reset to the first page. I've tried adding variations of "p_web.SetValue('_refresh_','saved')" to the same embed point on the included items browse, but none seem to work. It could be because this browse has the selecting of items disabled.
I would like to be able to get these last 2 resolved so I can push it out with the next update
Thanks
Matthew