There's probably an obvious answer to this but I can't spot it.
I have a form with a sub form the data in the sub form is from a table at the many end of a one to many relationship with the table upon which the main form is based. When the form opens I want the sub form to go to a new record but to have the ability to click through the other records using the nav buttons. Pretty straight foward when opening the form using the onLoad event of the sub form do "DoCmd.GoToRecord , , acNewRec" .
However if I change the record of the main form I want the sub form to again default to a new record . Both options I have tried give an error. Using the onCurrent event of the main form with either
"DoCmd.SelectObject acForm, "sfrmEnterContactDetails", no
DoCmd.GoToRecord , , acNewRec"
or
"DoCmd.GoToRecord acDataForm, "sfrmEnterContactDetails", acNewRec"
gives an error the object "sfrmEnterContactDetails" isn't open.
Any ideas
I have a form with a sub form the data in the sub form is from a table at the many end of a one to many relationship with the table upon which the main form is based. When the form opens I want the sub form to go to a new record but to have the ability to click through the other records using the nav buttons. Pretty straight foward when opening the form using the onLoad event of the sub form do "DoCmd.GoToRecord , , acNewRec" .
However if I change the record of the main form I want the sub form to again default to a new record . Both options I have tried give an error. Using the onCurrent event of the main form with either
"DoCmd.SelectObject acForm, "sfrmEnterContactDetails", no
DoCmd.GoToRecord , , acNewRec"
or
"DoCmd.GoToRecord acDataForm, "sfrmEnterContactDetails", acNewRec"
gives an error the object "sfrmEnterContactDetails" isn't open.
Any ideas