1

I am getting the User Defined Type not Defined error with the VBA code below.

I didn't write it and don't know how to fix it, but I need to use the file. It's an access database that requires users to log-in. I can't even log in (this is the error I get when I try), let alone import a file.

Can anyone help?

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
alextansc
  • 4,626
  • 6
  • 29
  • 45
Jessica
  • 11
  • 2
  • Possible duplicate of [User Defined Type Not Defined - Excel Macros](http://stackoverflow.com/questions/24261557/user-defined-type-not-defined-excel-macros) – Zev Spitz Dec 29 '16 at 08:00

1 Answers1

0

In the VBA Editor, menu Tools -> References, activate Microsoft XML, v6.0

The missing reference generates the compile error.

If you need to edit the code, check out the msxml tag info.

Community
  • 1
  • 1
Andre
  • 26,751
  • 7
  • 36
  • 80