Hi
I have an IP2007 form with 11 views in it.
I have buttons which move between the views.
I always open the form to the default view. Then the user will use the button to move to a different view.
This works on all but one of my views.
On one view I get the ...
System.Runtime.InteropServices.COMException
InfoPath cannot execute any view-related object model calls. The view is not ready.
at Microsoft.Office.Interop.InfoPath.SemiTrust.View.SwitchView(String bstrName)
at Microsoft.Office.Interop.InfoPath.SemiTrust.ViewObjectWrapper.SwitchView(String bstrName)
at Microsoft.Office.InfoPath.Internal.ViewInfoCollectionHost.SwitchView(String name)
I get this error whenever I select view X. I can select it before or after moving between other views and I get the same error.
For each button I have a sub...
Public Sub GotoXViewButton_Clicked(ByVal sender As Object, ByVal e As ClickedEventArgs)
GotoView("X")
End Sub
This then calls the following - all buttons to switch views go through this code - but only one view fails.
Public Sub GotoView(ByVal ViewName As String)
Me.CurrentView.DisableAutoUpdate()
'tried Me.ViewInfos.SwitchView(ViewName) here
Dim dataloaded As String = GetDSNodeValue("TemporaryVariables", "TemporaryVariables/" & ViewName & "Loaded")
Dim applicationID As String = GetNodeValue("/my:myFields/my:Identity/my:ApplicationIDGroup/my:ApplicationID", ".")
Dim FormStatus As String = GetNodeValue("/my:myFields/my:FormInfoGroup/my:CurrentStatus", ".")
If dataloaded <> "true" And FormStatus = "ExistingData" Then
'setupdates to off
SetDSNode("TemporaryVariables", "/TemporaryVariables/SetUpdates", "false")
Select Case ViewName
Case Is = "AView"
LoadIdentityFields()
Case Is = "BView"
Case Is = "CView"
LoadComplianceFields()
Case Is = "DView"
LoadBusinessFields()
Case Is = "EView"
LoadToolsFields()
Case Is = "FView"
LoadSustainFields()
Case Is = "GView"
LoadSupportFields()
Case Is = "HView"
LoadInterfacesFields()
Case Is = "XView"
LoadNoahFields()
End Select
SetDSNode("TemporaryVariables", "TemporaryVariables/" & ViewName & "Loaded", "true")
SetDSNode("TemporaryVariables", "/TemporaryVariables/SetUpdates", "true")
End If
Me.ViewInfos.SwitchView(ViewName)
Me.CurrentView.EnableAutoUpdate()
End Sub
I have tried the Me.ViewInfos.SwitchView(ViewName) on the second line of the code and still no luck... so my conclusion is that it must be something different about the view. I have deleted all content from the view and tried the button again and it still fails.
Does anyone have any idea what could be causing the issue ?
Thank you
Catharine