View Single Post
Old 07-11-2019, 11:03 PM   #7
arnelgp
Registered User
 
arnelgp's Avatar
 
Join Date: May 2009
Location: somewhere out there
Posts: 7,610
Thanks: 59
Thanked 2,438 Times in 2,338 Posts
arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice arnelgp is just really nice
Re: Can it be done??

the problem with your approach (code), is that you will find it hard to insert to the proper Page the subform. I've googled it an found none so far. the best approach you have is to design your form and create as many Pages with that many subform in it. then make those pages Visible property to No.

you also need a global counter variable as to how many Pages are visible.
you may also need a Table to save gintPages value.
on a module you may create:
Code:
Global gintPages As Integer

Public Function initPages()
gintPages = dlookup("Value", "theTable")
End Function
now create a macro (autoexec) that will RunCode the initPages() function.
so that everytime your app starts, ginitPages will be initialized as to how many
pages you have so far.

next on the Load event of your form, check each Page caption against the strInput.
if not found, increment gintPages and make the corresponding Page visible, and set its caption.

you can now set the SourceObject of the subform.
Code:
Me.subformName.SourceObject="table." & strInput
on the Unload event of your form, save gintPages to the table again.

btw I haven't tested it yet, only on my imagination.

__________________
"Never stop learning, because life never stops teaching"
arnelgp is offline   Reply With Quote
The Following User Says Thank You to arnelgp For This Useful Post:
NearImpossible (07-11-2019)