用户定义类型未定义错误

时间:2016-02-19 16:14:16

标签: vba ms-access access-vba msxml

我在下面的VBA代码中遇到User Defined Type not Defined错误。

我没有写它并且不知道如何修复它,但我需要使用该文件。它是一个需要用户登录的访问数据库。我甚至无法登录(这是我尝试时得到的错误),更不用说导入文件了。

有人可以帮忙吗?

Public Sub RefreshPrograms(pXML As MSXML2.DOMDocument)
    Dim sql As String

    Dim iNode As MSXML2.IXMLDOMNode
    Dim tnode As MSXML2.IXMLDOMNode
    Set iNode = pXML.selectSingleNode("//ProgramUrl")
    Set tnode = pXML.selectSingleNode("//" & mProgramNameTag)
    If iNode Is Nothing Then
        MsgBox "The file you attempted to import is not a valid program list file. You must download the program list file from the ASN RDA Information Server and then import it into the database. If you are trying to import a PoPS assessment XML file, return to the Program Selection window and click 'Import Assessment from XML'.", vbExclamation, "Invalid Program List File"
    ElseIf tnode Is Nothing Then
        MsgBox "The file you attempted to import is not a valid " & mName & " program list file. You must download the program list file from the ASN RDA Information Server and then import it into the database. If you are trying to import a PoPS assessment XML file, return to the Program Selection window and click 'Import Assessment from XML'.", vbExclamation, "Invalid Program List File"
    Else
        mURL = iNode.Text
        For Each iNode In pXML.selectNodes("//" & mProgramNameTag)
            sql = "INSERT INTO TempRemotePrograms (SourceID,RemoteID,Name,ACAT,Organization,PM,PEO) " & _
                  "Values(" & JoinStrings(True, mID, ReadLongElement(iNode, ID_COLUMN_XML_NAME), ReadStringElement(iNode, "ProgramName"), fACAT.FindByName(ReadStringElement(iNode, "ACAT")).ID, ReadStringElement(iNode, "OrganizationCode"), ReadStringElement(iNode, "PMName"), ReadStringElement(iNode, "PEOName")) & ")"
            CurrentDb.Execute sql, dbFailOnError
        Next
        If DCount("RemoteID", "TempRemotePrograms") > 0 Then
            ClearDeletedPrograms
            UpdateProgramInfo
            InsertNewProgramInfo
            mLastUpdated = Now()
            Save
        End If
    End If
    Set iNode = Nothing
End Sub

1 个答案:

答案 0 :(得分:0)

在VBA编辑器中,菜单工具 - >引用,激活 Microsoft XML,v6.0

缺少的引用会生成编译错误。

如果您需要修改代码,请查看msxml tag info