Looping through subforms (1 Viewer)

yahoo

Registered User.
Local time
Today, 10:34
Joined
Jan 10, 2013
Messages
13
Hi there

I'm hoping to hear some good ideas not necessary a ready solution. Discussion would do :)

First column of mainform consists of links(strategies' names) opening a subform for each row(strategy). Clicking first will open the subform attached

Than from subform I can send current strategy to the MS Word template. What Im looking for is a way to somehow loop strategies in main form to print lets say whole batch.
So technically it could look like for each strategy in batch 5 open subform, run printing macro, go back to mainform, next...
 

Attachments

  • mainform.PNG
    mainform.PNG
    56.5 KB · Views: 102
  • subform.PNG
    subform.PNG
    37.6 KB · Views: 104

mdlueck

Sr. Application Developer
Local time
Today, 05:34
Joined
Jun 23, 2011
Messages
2,631
I would think since you have a 1:M relationship, then it would be a simple matter of from the main form, have a button to generate Word files for the selected entry's children, have that execute a query to search for children associated with that parent, then loop through the result set generating a Word file for each.
 

yahoo

Registered User.
Local time
Today, 10:34
Joined
Jan 10, 2013
Messages
13
that would mean redoing the whole export to word code which is really complicated. I'd rather avoid it ;)
If i do this, I would write a new separate printing macro(looping (ADODB.Recordset) through strategies from current (user input))batch. I hope there could be a smarter way...
 

mdlueck

Sr. Application Developer
Local time
Today, 05:34
Joined
Jun 23, 2011
Messages
2,631
that would mean redoing the whole export to word code which is really complicated.

Then I would find a way to make that export to word a bit more generic / dynamic so that it may be called many times to create the necessary documents.
 

yahoo

Registered User.
Local time
Today, 10:34
Joined
Jan 10, 2013
Messages
13
So all I need to do is change references from me.form... to current 'byVal strategy' and call exportToWord macro for every run
thx
 

mdlueck

Sr. Application Developer
Local time
Today, 05:34
Joined
Jun 23, 2011
Messages
2,631
If it means that in your code, then yes sounds like a plan. ;)
 

Users who are viewing this thread

Top Bottom