Hi group,
I've got a 3 level hierarchy of forms, as such:
--Main
----frmSubOrders1
------frmSubOrderDeta ils1
Order Details is a subform of Orders and Orders is a subform of Main.
I also have an "Orders" table and an "Order Details" table.
I have a button on Main that opens "Orders" as the .SourceObject of frmSubOrders1. This works.
I have an event on a combo box that opens "Order Details" as the .SourceObject of frmSubOrderDeta ils1 in a similar fashion. This also works.
I'm using the following code to do this, set the focus on the subform, and open a new "Order Details" record using the default acActiveDataObj ect. This woks.
Dim stDocName As String
stDocName = "Order Details"
Me.frmSubOrderD etails1.SourceO bject = stDocName
Me.frmSubOrderD etails1.SetFocu s
DoCmd.GoToRecor d , , acNewRec
BUT... when I try to use the following syntax, it doesn't work:
DoCmd.GoToRecor d acDataForm, stDocName, acNewRec
I get the following error:
The object "Order Details" isn't open.
I can't figure out why this is happening...
Any advice?
Oliver
I've got a 3 level hierarchy of forms, as such:
--Main
----frmSubOrders1
------frmSubOrderDeta ils1
Order Details is a subform of Orders and Orders is a subform of Main.
I also have an "Orders" table and an "Order Details" table.
I have a button on Main that opens "Orders" as the .SourceObject of frmSubOrders1. This works.
I have an event on a combo box that opens "Order Details" as the .SourceObject of frmSubOrderDeta ils1 in a similar fashion. This also works.
I'm using the following code to do this, set the focus on the subform, and open a new "Order Details" record using the default acActiveDataObj ect. This woks.
Dim stDocName As String
stDocName = "Order Details"
Me.frmSubOrderD etails1.SourceO bject = stDocName
Me.frmSubOrderD etails1.SetFocu s
DoCmd.GoToRecor d , , acNewRec
BUT... when I try to use the following syntax, it doesn't work:
DoCmd.GoToRecor d acDataForm, stDocName, acNewRec
I get the following error:
The object "Order Details" isn't open.
I can't figure out why this is happening...
Any advice?
Oliver
Comment