PDA

View Full Version : Access ignoring the 
 from xml file



AMendes
02-11-2021, 06:00 AM
Hello,

when I insert a xml string "reprovados
Fazer" into a long text field of a access table I see it like this "reprovadosFazer"

Even in the access form based on that table I see it like this "reprovadosFazer"
But if I copy it into a notepad++ I see it as it should with the CRLF

reprovados
Fazer

What should I do to have always the correct format ? in the form and in the table

Thanks in advance
Ana

OBP
02-11-2021, 12:53 PM
How are you "inserting" the string?
How are obtaining the string from the xml file?

AMendes
02-12-2021, 06:48 AM
How are you "inserting" the string?
How are obtaining the string from the xml file?

...
Set objDoc = CreateObject("Msxml2.DOMDocument.3.0")
objDoc.async = False

objDoc.validateOnParse = True
objDoc.Load pURL
If (objDoc.parseError.errorCode <> 0) Then
Set objParseErr = objDoc.parseError
MsgBox ("Ficheiro Nao Encontrado " & objParseErr.reason)
Set objDoc = Nothing
End If

...
xmlvalOutosgrafica = objDoc.SelectSingleNode("//Detail").Attributes.getNamedItem("ft_pg_link_texto").Text
strValueList = strValueList & ", '" & _
Replace(xmlvalOutosgrafica, "'", "''") & "'"

...
strSql_Enc = "INSERT INTO encomendas (n_encomenda_luso,data_encomenda,n_cliente,tipo_estado,qtd_cilindros_ferro," & _
strFieldList_Enc & ",repeticao,departamento,tipo_impressao,outros_grafica)" & vbNewLine & _
"VALUES ('" & intNEncomendaLuso & "',Date(),'" & strIdCli & "',13,0" & strValueList & ");"

CurrentDb.Execute strSql_Enc, dbFailOnError



Here are the parts of the code.
Thanks

OBP
02-12-2021, 02:26 PM
Which string or fieldname is giving you the problem?
If you can identify it we should be able to replace the offending characters, unless it is the vbNewLine in the insert statement that is not working.

AMendes
02-21-2021, 08:34 AM
Sorry for the late reply

this is where a get the field from the xml

xmlvalOutosgrafica = objDoc.SelectSingleNode("//Detail").Attributes.getNamedItem("ft_pg_link_texto").Text

then I append it to the strValueList

I mean the the CR and the LineFeed are there in the field's table because when I copied from access to notepad or word it respects the CRLF.
Only in the Access Form is not showing.