Making a subforms Source Object see an exisitng form using VBA

D

dbp428

Making a subforms Source Object see an existing form using
VBA.

I wrote code to create a main form and a subform
I managed to add a subform to the main form. But I cannot
make the subform see the newly created subform. There
appears to be no property available to do this using VBA.
Here is my code:

'insert sub form into main form
Dim SourceObjectName As String
SourceObjectName = FormName & " Subform"
Set ctlSubform = CreateControl(frmMain.Name,
acSubform, acDetail, frmSub.Name, SourceObjectName, 3500,
100, 6000, 2000)
'ctlSubform.Name = frmSub.Name
Set ctlButton = CreateControl(frmMain.Name,
acCommandButton, acDetail, "", "", 1000, 1200, 1200, 400)
ctlButton.Caption = "Find..."
-------------------
 

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