I'm getting there...
I'm trying to iterate between all the views in the form and print each view
to PDF via code.
allViews = Me.ViewInfos
For a = 0 To allViews.Count - 1
strViewName = Me.ViewInfos(a).Name
Me.ViewInfos.SwitchView(strViewName)
....
Next
The code itself seems to work in that it will select the name of each of the
views in turn in the strViewName variable, however the switchview only works
for the first item through the loop. In this case it is the data entry view.
The data presentation views are never selected.
What am I missing here? I read somewhere you can only change the view once
in code but this would not make sense. Any help would be appreciated.
H
Greg Collins - 02 Jan 2008 23:58 GMT
Your not missing anything... there can only be one view switch at a time.
View switching while another view switch is going on is not allowed. A view
switch is not complete until all code has finished, etc, and the view
finishes drawing itself.
You might look into the OnContextChange event handler and write some code in
there to perform what you want. A context change occurs after the view
switch is complete.

Signature
Greg Collins
Microsoft MVP
Visit Braintrove at http://www.braintrove.com
Visit InfoPathDev at http://www.infopathdev.com