Problem with For loop, iterating through XML Doc
I have the following loop:
The XML document has been set up as you would expect.
For intCount = 0 to objElement.childNodes.length - 1
strXMLUser = objElement.childNodes.Item(intCount).childNodes.it em(1).text
strXMLPassword = objElement.childNodes.Item(intCount).childNodes.it em(6).text
If (strEnteredUser = strXMLUser) AND (strEnteredPassword = strXMLPassword) then
strSalutation = objElement.childNodes.Item(intCount).childNodes.it em(2).text
strSurname = objElement.childNodes.Item(intCount).childNodes.it em(3).text
else
Session ("Error") = Session ("Error") & "Username and Password match not found"
End If
Next
As you can see, it iterates through each record and if the User and Password match a record, it logs them in by greeting the user. Now, this works fine as long as the record exists. If it doesn't, it throws the following error:
Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'objElement.childNodes.Item(...).childNodes.Item(. ..)'
It seems to be a problem that the loop gets to the end of the file and fails to find a record.
Can anyone help?
Richard
|