I am trying to import and XML file into an existing Access table. The table has around 60+ fields, and the XML node name is equal to the field name. What I want to do is write a generic routine that will use the node name as the field name so that I don't need to deal with each field individually.
here is the code. The problem is in the ELSE of the CASE statement
here is the code. The problem is in the ELSE of the CASE statement
Code:
Private Sub ProcessPatientNodes(ByVal inNodeList As IXMLDOMNodeList)
Dim objNode As IXMLDOMNode
Dim strNodeName As String
rstPatient.AddNew
For Each objNode In inNodeList
strNodeName = UCase(objNode.NodeName)
Select Case strNodeName
Case Is = "ID"
'ID is an auto incremented field so do not use the value in the XML file
Case Is = "DATEOFBIRTH"
rstPatient("DateofBirth") = ISODate(objNode.Text, "D")
Case Else
'Process a standard String field
rstPatient(strNodeName) = objNode.Text
End Select
Next objNode
rstPatient.Update
End Sub