Vbscript 由于对象的当前状态,操作无效
我有一个带有按钮和以下事件代码的Infopath 2010表单:Vbscript 由于对象的当前状态,操作无效,vbscript,infopath2010,Vbscript,Infopath2010,我有一个带有按钮和以下事件代码的Infopath 2010表单: Public Sub txtGetCC_Changing(ByVal sender As Object, ByVal e As XmlChangingEventArgs) ' Ensure that the constraint you are enforcing is compatible ' with the default value you set for this XML node.
Public Sub txtGetCC_Changing(ByVal sender As Object, ByVal e As XmlChangingEventArgs)
' Ensure that the constraint you are enforcing is compatible
' with the default value you set for this XML node.
Dim myNav As XPathNavigator = Me.MainDataSource.CreateNavigator
If myNav.SelectSingleNode("//my:txtGetCC", Me.NamespaceManager).ToString.Length > 0 Then
Dim myIterator As XPathNodeIterator = myNav.Select("/my:myFields/my:group11/my:group12", Me.NamespaceManager)
Dim CCnummer As String = ""
Dim CCsource As DataSource = Me.DataSources("CostCenters")
Dim email As String = ""
While myIterator.MoveNext
CCnummer = myIterator.Current.SelectSingleNode("my:cbRTcc", Me.NamespaceManager).Value
Dim myNavigator As XPathNavigator = Me.DataSources("CostCenters").CreateNavigator
Dim rows As XPathNodeIterator = myNavigator.Select("/dfs:myFields/dfs:dataFields/d:CostCenters", Me.NamespaceManager)
email = ""
While (rows.MoveNext)
Dim ccnumber As String = rows.Current.SelectSingleNode("@CCnumber", Me.NamespaceManager).Value
If ccnumber = CCnummer Then
email = rows.Current.SelectSingleNode("@Email", Me.NamespaceManager).Value
Exit While
End If
End While
myIterator.Current.SelectSingleNode("//my:txtCCowner", Me.NamespaceManager).SetValue(email)
End While
End If
End Sub
在最后一端之前的线路不工作。
我想用外部数据源中的电子邮件地址更新重复表中的列txtcowner。
除了这条线,其他都能用
我得到的错误消息是:由于对象的当前状态,操作无效。
为什么我会犯这个错误,我做错了什么
非常感谢您的帮助
rg。
Eric您的代码看起来不像VBScript。这是VBA吗?