Will not go to New Record in a subform.

G

Guest

I am 'controlling' a form (Form_Cust) via code in another form (Form_Control)
and want to go to a new record in a subform (Form_Cust_Subform) in Form_Cust.

I use the code:
Forms("Form_Cust")("Form_Cust_Subform").SetFocus
DoCmd.GoToRecord , "Form_Cust_Subform", acNewRec
but the error says "the object is not open".

I have tried many combinations of the DoCMd eg
DoCmd.GoToRecord , "Forms('Form_Cust')('Form_Cust_Subform')", acNewRec
inserted 'acDataForm' in the appropriate spot etc

NO WAY will it happen!
 
A

Allen Browne

The subform is not "open" in its own right, so try something like this:

With Forms("Form_Cust")
.SetFocus 'Make it the active form.
!Form_Cust_Subform.SetFocus 'Make the subform control the active
one.
!Form_Cust_Subform.Form![SomeControl].SetFocus 'Somecontrol in
subform.
RunCommand acCmdRecordsGotoNew
End With
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top