Hi,
I have a VBA module in an access database which sends XML to an outside location. The code is below, however when I run the script I keep getting the error "Run-time error '-2147024809 (80070057)': WSDLReader: XML Parser failed at linenumber 61, lineposition 19, reason is The name in the end tag of the element must match the element type in the start tag"
I have gone though the XML tags and I cannot see a problem. Can anyone help me? :banghead:
I have a VBA module in an access database which sends XML to an outside location. The code is below, however when I run the script I keep getting the error "Run-time error '-2147024809 (80070057)': WSDLReader: XML Parser failed at linenumber 61, lineposition 19, reason is The name in the end tag of the element must match the element type in the start tag"
I have gone though the XML tags and I cannot see a problem. Can anyone help me? :banghead:
Code:
Private Sub btnMorganAsh_Click()
Dim Msg, Style, Title, Response, MyString
Msg = "Are you sure you want to submit this Application for a tele-interview?" ' Define message.
Style = vbYesNo + vbExclamation + vbDefaultButton2 ' Define buttons.
Title = "Submit for Tele-Interview" ' Define title.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbNo Then ' User chose Yes.
Exit Sub ' Perform some action.
Else ' User chose No.
End If
Dim XMLOutput As String
Dim MyDB As Database
Dim rst As Recordset
Dim fld As Field
Dim strText As String
Dim MyTableName As String
Set MyDB = CurrentDb
' Set rst = MyDB.OpenRecordset("QryHealthQs")
strText = "<?xml version=""1.0""?>" & vbCrLf
If IsMissing(TableName) = True Then
MyTableName = qryHealthQs
' Else
' MyTableName = TableName
End If
strText = strText & "<TiRequests format=""cirencester"">" & vbCrLf & "<qryHealthQs>" & vbCrLf
strText = strText & "<AppRefID>" & Me.AppRefID & "</AppRefID>" & vbCrLf & "<Title>" & [Forms]![frmAppQsMEI]![Title] & "</Title>" & vbCrLf & "<FirstName>" & Me.FirstName & "</FirstName>" & vbCrLf & _
"<AppName>" & Me.AppName & "</AppName>" & vbCrLf & "<AppAdd1>" & Me.AppAdd1 & "</AppAdd1>" & vbCrLf & "<AppAdd2>" & Me.AppAdd2 & "</AppAdd2>" & vbCrLf & "<AppAdd3>" & Me.AppAdd3 & "</AppAdd3>" & vbCrLf & _
"<AppAdd4>" & Me.AppAdd4 & "</AppAdd4>" & vbCrLf & "<AppPostCode>" & Me.AppPostCode & "</AppPostCode>" & vbCrLf & "<DateOfBirth>" & Me.DateOfBirth & "</DateOfBirth>" & vbCrLf & _
"<AppEmail>" & Me.AppEmail & "</AppEmail>" & vbCrLf & "<ClientPhoneHome>" & Me.ClientPhoneHome & "</ClientPhoneHome>" & vbCrLf & "<ClientPhoneWork>" & Me.ClientPhoneWork & "</ClientPhoneWork>" & vbCrLf & _
"<ClientPhoneMob>" & Me.ClientPhoneMob & "</ClientPhoneMob>" & vbCrLf & "<Occupation>" & Me.Occupation & "</Occupation>" & vbCrLf & "<TeleDaysSick>" & Me.TeleDaysSick & "</TeleDaysSick>" & vbCrLf & _
"<TeleContracts>" & Me.TeleContracts & "</TeleContracts>" & vbCrLf & "<TeleClaims>" & Me.TeleClaims & "</TeleClaims>" & vbCrLf & "<TeleComp>" & Me.TeleComp & "</TeleComp>" & vbCrLf & _
"<Tele4>" & Me.Tele4 & "</Tele4>" & vbCrLf & "<Tele5>" & Me.Tele5 & "</Tele5>" & vbCrLf & "<Tele6>" & Me.Tele6 & "</Tele6>" & vbCrLf & "<Tele7A>" & Me.Tele7A & "</Tele7A>" & vbCrLf & _
"<Tele7B>" & Me.Tele7B & "</Tele7B>" & vbCrLf & "<Tele7C>" & Me.Tele7C & "</Tele7C>" & vbCrLf & "<Tele7D>" & Me.Tele7D & "</Tele7D>" & vbCrLf & "<Tele7E>" & Me.Tele7E & "</Tele7E>" & vbCrLf & _
"<Tele7F>" & Me.Tele7F & "</Tele7F>" & vbCrLf & "<Tele7G>" & Me.Tele7G & "</Tele7G>" & vbCrLf & "<Tele8>" & Me.Tele8 & "</Tele8>" & vbCrLf & "<Tele9>" & Me.Tele9 & "</Tele9>" & vbCrLf & _
"<Tele10A>" & Me.Tele10A & "</Tele10A>" & vbCrLf & "<Tele10B>" & Me.Tele10B & "</Tele10B>" & vbCrLf & "<Tele11>" & Me.Tele11 & "</Tele11>" & vbCrLf & "<Tele12>" & Me.Tele12 & "</Tele12>" & vbCrLf & _
"<Tele13>" & Me.Tele13 & "</Tele13>" & vbCrLf & "<Tele14A>" & Me.Tele14A & "</Tele14A>" & vbCrLf & "<Tele14B>" & Me.Tele14B & "</Tele14B>" & vbCrLf & "<Tele14C>" & Me.Tele14C & "</Tele14C>" & vbCrLf & _
"<Tele15A>" & Me.Tele15A & "</Tele15A>" & vbCrLf & "<Tele15B>" & Me.Tele15B & "</Tele15B>" & vbCrLf & "<Tele16>" & Me.Tele16 & "</Tele16>" & vbCrLf & "<Tele17>" & Me.Tele17 & "</Tele17>" & vbCrLf & _
"<Tele18>" & Me.Tele18 & "</Tele18>" & vbCrLf & "<Tele19>" & Me.Tele19 & "</Tele19>" & vbCrLf & "<Tele20>" & Me.Tele20 & "</Tele20>" & vbCrLf & "<Tele21>" & Me.Tele21 & "</Tele21>" & vbCrLf & _
"<Tele22>" & Me.Tele21 & "</Tele22>" & vbCrLf & "<Tele23>" & Me.Tele23 & "</Tele23>" & vbCrLf & "<Tele24>" & Me.Tele24 & "</Tele24>" & vbCrLf & "<Tele25A>" & Me.Tele25A & "</Tele25A>" & vbCrLf & _
"<Tele25B>" & Me.Tele25B & "</Tele25B>" & vbCrLf & "<Tele25C>" & Me.Tele25C & "</Tele25C>" & vbCrLf & "<Tele26>" & Me.Tele26 & "</Tele26>" & vbCrLf & "<Tele27>" & Me.Tele27 & "</Tele27>" & vbCrLf & _
"<Tele28>" & Me.Tele28 & "</Tele28>" & vbCrLf & "<Tele29>" & Me.Tele29 & "</Tele29>" & vbCrLf & "<Tele30>" & Me.Tele30 & "</Tele30>" & vbCrLf & "<Tele31>" & Me.Tele31 & "</Tele31>" & vbCrLf & _
"<Tele32>" & Me.Tele32 & "</Tele32>" & vbCrLf & "<Tele33>" & Me.Tele33 & "</Tele33>" & vbCrLf & "<Tele34>" & Me.Tele34 & "</Tele34>" & vbCrLf & "<Tele35>" & Me.Tele35 & "</Tele35>" & vbCrLf & _
"<Tele36>" & Me.Tele36 & "</Tele36>" & vbCrLf & "<Tele37A>" & Me.Tele37A & "</Tele37A>" & vbCrLf & "<Tele37B>" & Me.Tele37B & "</Tele37B>" & vbCrLf & "<Tele37C>" & Me.Tele37C & "</Tele37C>" & vbCrLf & _
"<TeleAlcTob>" & Me.TeleAlcTob & "</TeleAlcTob>" & vbCrLf & "<MEI>" & Me.MEI & "</MEI>" & vbCrLf & "<TeleBMI>" & Me.TeleBMI & "</TeleBMI>" & vbCrLf & "<TeleFH>" & Me.TeleFH & "</TeleFH>" & vbCrLf & _
"<Gender>" & Me.Gender & "</Gender>" & vbCrLf & "<MiddleT>" & Me.MiddleTI & "</MiddleT>" & vbCrLf & "<notes>" & Me.Notes & "</notes>" & vbCrLf & _
"<uwcomments>" & Me.UWNotes & "</uwcomments>" & vbCrLf & "</qryHealthQs>" & vbCrLf & "</TiRequests>"
Set MyDB = Nothing
XMLOutput = strText
txtUsername = "CIR"
txtPassword = "password"
txtXml = XMLOutput
'' Output to file::
' MyFile = "c:\terminal\" & "xmloutput.xml"
' fnum = FreeFile()
' Open MyFile For Output As fnum
' Print #fnum, XMLOutput
' Close #fnum
''''' 'Error Trap
''''' On Error GoTo wsm_SubmitTiRequestsAsXmlTrap
''' Dim ws As clsws_TiRequestsService
''' Set ws = New clsws_TiRequestsService
'''
''' txtSuccess.SetFocus
''' txtSuccess.Text = ws.wsm_SubmitTiRequestsAsXml(str_username, str_password, str_tiRequestsXml)
Dim ws As clsws_TiRequestsService
'declaration of new string variable to pass into the service call
Dim str_Response As String
Set ws = New clsws_TiRequestsService
txtSuccess.SetFocus
'The txtSuccess.Text field will contain the boolean result from the wsm_SubmitTiRequestsAsXml method call
txtSuccess.Text = ws.wsm_SubmitTiRequestsAsXml(txtUsername, txtPassword, txtXml, str_Response)
'Once the call has been made, you will have a result in txtSuccess.Text of True/False and
'from this point you will be able to use the strRes variable, which will contain "Success" if
'the service returned True or an error message if the service returned False
'You may want to to do something like: txtSuccess.Text = strRes
txtSuccess.SetFocus
txtSuccess.Text = str_Response
If str_Response = "Success" Then
DoCmd.RunMacro ("SubmitXML")
Call TeleEmail_Click
Else
Dim Msg2, Style2, Title2, Response2, MyString2
Msg2 = "Submission Failed: " & str_Response ' Define message.
Style2 = vbOKOnly + vbExclamation + vbDefaultButton2 ' Define buttons.
Title2 = "SUBMISSION FAILED!" ' Define title.
' Display message.
Response2 = MsgBox(Msg2, Style2, Title2)
If Response = vbOK Then ' User chose Yes.
Exit Sub ' Perform some action.
Else ' User chose No.
End If
End If
End Sub