I created an xml file with data from an access 97 database and now I want to validate it in access vb, so the file will have less of a chance of being sent back as a dud. I am using msxml4 and DOMDocument30 and XMLSchemaCache30 as the variable types. Here is the code:

Dim mydom
Sub jmrtest()
Dim Dom As DOMDocument30
Set Dom = New DOMDocument30

Dom.async = False
Dom.Load "c:\xmlschema\layout.xsd"

Dim Xsd As XMLSchemaCache30
Set Xsd = New XMLSchemaCache30
Xsd.addCollection Dom.namespaces

Set mydom.schemas = Xsd
mydom.validateOnParse = True

mydom.Load ("c:\xmlschema\RCT.xml")

If mydom.validate.errorCode <> 0 Then
MsgBox mydom.validate.Reason
Exit Sub
End If
End Sub

I don't know why I am getting an 424 Object Required error on the following line:

Set mydom.schemas = Xsd

My guess is that it has something to do with the Xsd.add Collection line, but I am not sure. Does anyone know why this error is coming up?
Is there a better way to validate an xml file in vb rather than parsing it?