I'm trying to add controls to a form at runtime as I will need to make some small dynamic changes to the form once loaded so I'm starting with trying to add a subform before moving on to other controls.
So far, I have this short sub:
When I open the host form, I get the following error:
I'm not sure why it cannot add the form - it exists as does the subform.
Has anyone come across this before?
Thanks
So far, I have this short sub:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim ctlSub1 As SubForm
Call DoCmd.RunCommand(acCmdLayoutView)
Set ctlSub1 = CreateControl(Forms("compa").Name, acSubform, , Forms("subform").Name, , 20, 20, 50, 100)
Call DoCmd.RunCommand(acCmdFormView)
End Sub
When I open the host form, I get the following error:
Run-time error '29054'
Microsoft Access can't add, rename, or delete the control(s) you requested
I'm not sure why it cannot add the form - it exists as does the subform.
Has anyone come across this before?
Thanks